stb
stb copied to clipboard
stb_ds: Fix `d[i] << 24` undefined behaviour due to overflow
Because of int promotion, d[i] << 24 overflows an int, resulting in UB.
Found via ubsan in clang 18:
stb/stb_ds.h:1124:67: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior stb/stb_ds.h:1124:67