]> git.ipfire.org Git - thirdparty/haproxy.git/commit
IMPORT: cebtree: Replace offset calculation with offsetof to avoid UB
authorBen Kallus <benjamin.p.kallus.gr@dartmouth.edu>
Wed, 29 Oct 2025 12:38:51 +0000 (08:38 -0400)
committerWilly Tarreau <w@1wt.eu>
Fri, 7 Nov 2025 06:32:58 +0000 (07:32 +0100)
commitd5ca3bb3b45f8c3899a522283038fbfbbb14f242
tree9d4eda5002d90087a5568d4df5379d0d836c1e92
parent4c3351fd63b5dbf9ce775f7007e2c5488e0a419a
IMPORT: cebtree: Replace offset calculation with offsetof to avoid UB

This is the same as the equivalent fix in ebtree:

The C standard specifies that it's undefined behavior to dereference
NULL (even if you use & right after). The hand-rolled offsetof idiom
&(((s*)NULL)->f) is thus technically undefined. This clutters the
output of UBSan and is simple to fix: just use the real offsetof when
it's available.

This is cebtree commit 2d08958858c2b8a1da880061aed941324e20e748.
include/import/cebtree-prv.h