Page MenuHomeFreeBSD

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

Authored by markj on Wed, Mar 5, 10:59 AM.
Tags
None
Referenced Files
F112580835: D49242.id151910.diff
Thu, Mar 20, 2:52 AM
F112580813: D49242.id152069.diff
Thu, Mar 20, 2:51 AM
Unknown Object (File)
Wed, Mar 19, 9:18 PM
Unknown Object (File)
Mon, Mar 10, 3:04 AM
Unknown Object (File)
Sat, Mar 8, 9:53 AM
Unknown Object (File)
Fri, Mar 7, 5:01 AM
Unknown Object (File)
Fri, Mar 7, 4:20 AM
Unknown Object (File)
Thu, Mar 6, 7:11 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