Permalink
Browse files

Proper bounds check on heap index and queue size.

  • Loading branch information...
1 parent 84cfd9c commit 6cfe499d760f41f7020e9581a8cf667e8aad2901 @kr committed Dec 2, 2008
Showing with 1 addition and 1 deletion.
  1. +1 −1 pq.c
View
2 pq.c
@@ -160,7 +160,7 @@ pq_remove(pq q, job j)
unsigned long long int id;
unsigned int pri;
- if (q->used == 0) return NULL;
+ if (j->heap_index >= q->used) return NULL;
if (q->heap[j->heap_index] != j) return NULL;
id = j->id;

0 comments on commit 6cfe499

Please sign in to comment.