Newer Clang versions added more UBSan checks, in particular:
-fsanitize=pointer-overflow check was extended to catch the cases where a non-zero offset is applied to a null pointer, or the result of applying the offset is a null pointer.
fsanitize=function: Indirect call of a function through a function pointer of the wrong type.
This commit adds the scaffolding for the second (new) check plus fixes the places triggered by this check. This commit also fixes UBs found by the extended first check.
Description of the changes
Newer Clang versions added more UBSan checks, in particular:
-fsanitize=pointer-overflow
check was extended to catch the cases where a non-zero offset is applied to a null pointer, or the result of applying the offset is a null pointer.fsanitize=function
: Indirect call of a function through a function pointer of the wrong type.This commit adds the scaffolding for the second (new) check plus fixes the places triggered by this check. This commit also fixes UBs found by the extended first check.
See:
How to test this PR?
CI is enough for older UBSan versions. To test newer UBSan versions, run on Ubuntu 24.04 (and default Clang version there, which is v18).
This change is![Reviewable](https://reviewable.io/review_button.svg)