commit f47e9216ca57a589fd5c47edb614b7385bde87ae from: Omar Polo date: Mon Feb 19 15:20:02 2024 UTC ev: fix two off-by-one in bubbledown commit - a74e6b4d71a264f0ca2fd27e25b1acfb811508fc commit + f47e9216ca57a589fd5c47edb614b7385bde87ae blob - 823141c99c70730556e47ca3cf8e377573972a30 blob + 558a8bff492597d849cd3f1466060da335863727 --- ev.c +++ ev.c @@ -341,12 +341,12 @@ bubbledown(size_t i) r = 2 * i + 2; /* base case: there are no children */ - if (l > base->ntimers) + if (l >= base->ntimers) return; /* find the smaller child */ s = r; - if (r > base->ntimers || + if (r >= base->ntimers || timercmp(&base->timers[l].tv, &base->timers[r].tv, <)) s = l;