ubsan pointer-overflow errors with clang 10
Categories
(Firefox Build System :: General, defect)
Tracking
(firefox78 fixed)
Tracking | Status | |
---|---|---|
firefox78 | --- | fixed |
People
(Reporter: away, Assigned: away)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
There are various instances of this error showing up in try pushes, but the most prevalent one (which makes pretty much every linux asan test orange) is:
xmlparse.c:1942:24: runtime error: applying zero offset to null pointer
The amount of pointer-overflow diagnostics has increased considerably in LLVM 10: https://github.com/llvm/llvm-project/commit/536b0ee40ab97f2878dc124a321cf9108ee3d233
Comment 2•5 years ago
|
||
Slightly tangentially, the error mentioned in comment 0 is specified to be UB in some versions of C++, but C++17 specifically relaxed things in this regard: "If the value 0 is added to or subtracted from a null pointer value, the result is a null pointer value." C++17 [expr.add]p7.
But xmlparse.c
is obviously not C++, and neither C11 nor C18 seem to include the language C++17 has to make clear that adding zero to a null pointer results in a null pointer.
Yeah, the commit message from clang says:
To make things more fun, in C (6.5.6p8), applying *any* offset to null pointer
is undefined, although Clang front-end pessimizes the code by not lowering
that info, so this UB is "harmless".
Updated•5 years ago
|
Comment 6•5 years ago
|
||
bugherder |
Comment 8•5 years ago
|
||
bugherder |
Description
•