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)
Wed, Sep 23, 11:56 PM
Unknown Object (File)
Sat, Sep 19, 11:39 PM
Unknown Object (File)
Sat, Sep 19, 11:29 PM
Unknown Object (File)
Sat, Sep 19, 11:15 PM
Unknown Object (File)
Thu, Sep 17, 12:05 PM
Unknown Object (File)
Mon, Sep 14, 9:17 AM
Unknown Object (File)
Fri, Sep 11, 12:26 PM
Unknown Object (File)
Tue, Sep 8, 9:29 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