The cherry-picked #428 wrapped no_sanitize attributes on read_varint() and
read_varlong() in `#ifndef CAREFUL_ALIGNMENT`, but byteorder.h always
#defines CAREFUL_ALIGNMENT (to 0 or 1), so that guard is never true and the
attributes were dead code.
They are also unnecessary: both functions read the assembled value through
an aligned union member (union { char b[5]; int32 x; }), not an unaligned
cast, so UBSan's alignment check never fires there (verified: the ASan+UBSan
suite is clean without them). Remove the whole block rather than fix the
guard. (The byteorder.h annotations from #428, which are real and correctly
placed inside the !CAREFUL_ALIGNMENT branch, are kept.)
return IVAL(b, 0);
}
-#ifndef CAREFUL_ALIGNMENT
-#ifdef __clang__
-__attribute__((no_sanitize("undefined")))
-#elif GCC_VERSION >= 409
-__attribute__((no_sanitize_undefined))
-#endif
-#endif
int32 read_varint(int f)
{
union {
return u.x;
}
-#ifndef CAREFUL_ALIGNMENT
-#ifdef __clang__
-__attribute__((no_sanitize("undefined")))
-#elif GCC_VERSION >= 409
-__attribute__((no_sanitize_undefined))
-#endif
-#endif
int64 read_varlong(int f, uchar min_bytes)
{
union {