mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-06-08 14:15:46 -04:00
io: drop the dead/unnecessary read_varint UBSan guard
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.)
This commit is contained in:
14
io.c
14
io.c
@@ -1813,13 +1813,6 @@ uint32 read_uint(int f)
|
||||
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 {
|
||||
@@ -1852,13 +1845,6 @@ int32 read_varint(int f)
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user