Page MenuHomeFreeBSD

libdtrace: Fix an off-by-one in the priority queue implementation
ClosedPublic

Authored by markj on Mar 5 2025, 10:59 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 28, 12:36 AM
Unknown Object (File)
Mon, Apr 27, 8:29 AM
Unknown Object (File)
Tue, Apr 21, 1:35 AM
Unknown Object (File)
Tue, Apr 21, 1:30 AM
Unknown Object (File)
Tue, Apr 21, 1:30 AM
Unknown Object (File)
Tue, Apr 21, 12:56 AM
Unknown Object (File)
Sun, Apr 19, 9:59 PM
Unknown Object (File)
Sat, Apr 18, 7:14 PM
Subscribers

Details

Summary

The zero'th index in the array is unused, so a priority queue of N elements
needs N+1 array slots. Fix the allocation.

Also fix the assertion in dt_pq_insert(): the assertion needs to be checked
after incrementing the count of items in the priority queue, otherwise it can
miss an overflow.

Reported by: CHERI
Sponsored by: Innovate UK

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable