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
F151115239: D49242.id152069.diff
Mon, Apr 6, 4:31 AM
Unknown Object (File)
Sun, Mar 29, 8:50 AM
Unknown Object (File)
Sun, Mar 29, 2:54 AM
Unknown Object (File)
Thu, Mar 26, 9:54 AM
Unknown Object (File)
Wed, Mar 25, 5:48 AM
Unknown Object (File)
Mon, Mar 23, 12:10 AM
Unknown Object (File)
Fri, Mar 20, 12:03 PM
Unknown Object (File)
Tue, Mar 17, 11:04 AM
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