0
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)

日志显示我可能自己编写的最后一个代码位于 main:33:5,这是main() 的第一行,它只包含SDL_Init(SDL_INIT_EVERYTHING);

SDL 是否有意这样做,如果是,有没有办法抑制这种情况?

4

0 回答 0