t-prio-queue: check result array bounds
commit30ff05094c145397d88ead89c3937d1a058ed98a
authorRené Scharfe <l.s.r@web.de>
Sat, 16 Mar 2024 21:09:47 +0000 (16 22:09 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Mar 2024 16:25:54 +0000 (18 09:25 -0700)
treef38e5ea72736f66ae6adcf03e3d48d142fb3deb1
parente6f9cb76ea14b955fb7b4fcb8dea0786b5b108d3
t-prio-queue: check result array bounds

Avoid reading past the end of the "result" array, which could otherwise
happen if the prio-queue were to yield more items than were put into it
due to an implementation bug, or if the array has not enough entries due
to a test bug.

Also check at the end whether all "result" entries were consumed, which
would not be the case if the prio-queue forgot some entries or the test
definition contained too many.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/unit-tests/t-prio-queue.c