HomeFreeBSD

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

Description

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

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
MFC after: 2 weeks
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D49242

Details

Provenance
markjAuthored on Mon, Mar 10, 3:00 AM
Differential Revision
D49242: libdtrace: Fix an off-by-one in the priority queue implementation
Parents
rGf9b4092743fc: acpi_wmi: Add type check before evaluaeting query ACPI method
Branches
Unknown
Tags
Unknown