Skip to content

scanner: Fix undefined behavior around qsort

Fergus Dall requested to merge sidereal/wayland:ubsan-fix into main

According to clang, qsort cannot be passed a null pointer, even if the size is specified to be zero. The scanner can hit this while trying to sort forward declarations if it happens to be building a protocol file that doesn't require any, either in the header or the source.

Signed-off-by: Fergus Dall sidereal@google.com

For the record, this was triggered by this custom protocol used in ChromeOS.

Merge request reports