prioq: add one more assertion
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Oct 2018 14:35:22 +0000 (23:35 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 16 Oct 2018 16:08:51 +0000 (01:08 +0900)
src/basic/prioq.c

index e816b2c..1e4d8d1 100644 (file)
@@ -88,6 +88,7 @@ static void swap(Prioq *q, unsigned j, unsigned k) {
 
 static unsigned shuffle_up(Prioq *q, unsigned idx) {
         assert(q);
+        assert(idx < q->n_items);
 
         while (idx > 0) {
                 unsigned k;