SDL2 SDL_Init function triggers memory sanitizer error (relying on uninitialized data)

197 Views Asked by At
clang -g -fsanitize=memory -Wconversion -Wsign-conversion -Wextra -Wall -Werror -pedantic -I/usr/include/SDL2 -lSDL2_image -lSDL2_gfx -lSDL2 -lSDL2_ttf -lc -lm ./deps/**/*.c ./src/*.c ./src/**/*.c -o ./bin/output

./bin/output

Uninitialized bytes in __interceptor_strlen at offset 5 inside [0x717000000310, 6)
==172913==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f39adb0bd0b  (/usr/lib/libSDL2-2.0.so.0+0x7fd0b)
    #1 0x7f39adb7a338  (/usr/lib/libSDL2-2.0.so.0+0xee338)
    #2 0x7f39adb7e840  (/usr/lib/libSDL2-2.0.so.0+0xf2840)
    #3 0x7f39adb4e33e  (/usr/lib/libSDL2-2.0.so.0+0xc233e)
    #4 0x7f39adaad307  (/usr/lib/libSDL2-2.0.so.0+0x21307)
    #5 0x560a0db3c817 in main /home/ishidex2/progs/get_out/./src/main.c:33:5
    #6 0x7f39ad8ddb24 in __libc_start_main (/usr/lib/libc.so.6+0x27b24)
    #7 0x560a0daa83fd in _start (/home/ishidex2/progs/get_out/bin/output+0x213fd)

Logs show the last code I could have possibly written myself was at main:33:5, which is the first line of main() that just contains SDL_Init(SDL_INIT_EVERYTHING);

Does SDL do that intentionally, if so, is there a way to supress that?

0

There are 0 best solutions below