summaryrefslogtreecommitdiff
path: root/lib/rbcodec/metadata/metadata_common.h
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-04-17 16:15:09 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-04-17 11:37:34 -0400
commitfca7b8e2ff400cfe6307f138c688cc1dcd875ce9 (patch)
tree6a3df9679649fdcf2135e9a283b0e618ebf3bd6a /lib/rbcodec/metadata/metadata_common.h
parentc6df8cc4f7cdbff2bf86d40be3ee1e9daae6c9b6 (diff)
downloadrockbox-fca7b8e2ff400cfe6307f138c688cc1dcd875ce9.tar.gz
rockbox-fca7b8e2ff400cfe6307f138c688cc1dcd875ce9.zip
Fix undefined behavior that blocks compiling with UBSan
Left shifts are not defined in C if they would cause signed overflow, so these expressions get instrumented, which makes them unusable as switch values and triggers compile errors when compiling with UBSan. Change-Id: I0588d4be1e00ba1cfde0eac119ead368b20d10c9
Diffstat (limited to 'lib/rbcodec/metadata/metadata_common.h')
-rw-r--r--lib/rbcodec/metadata/metadata_common.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rbcodec/metadata/metadata_common.h b/lib/rbcodec/metadata/metadata_common.h
index 14115b745a..0f6fcb279c 100644
--- a/lib/rbcodec/metadata/metadata_common.h
+++ b/lib/rbcodec/metadata/metadata_common.h
@@ -30,7 +30,8 @@
30#define TAG_NAME_LENGTH 32 30#define TAG_NAME_LENGTH 32
31#define TAG_VALUE_LENGTH 128 31#define TAG_VALUE_LENGTH 128
32 32
33#define FOURCC(a,b,c,d) (((a)<<24) | ((b) << 16) | ((c) << 8) | (d)) 33#define FOURCC(a,b,c,d) ((((unsigned long)(a)) << 24) | (((unsigned long)(b)) << 16) | \
34 (((unsigned long)(c)) << 8) | ((unsigned long)(d)))
34 35
35enum tagtype { TAGTYPE_APE = 1, TAGTYPE_VORBIS }; 36enum tagtype { TAGTYPE_APE = 1, TAGTYPE_VORBIS };
36 37