Open ghost opened 6 years ago
I can reproduce this here too.
$ ./retroarch
=================================================================
==30451==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x604000000731 at pc 0x7f528900486c bp 0x7ffcbe8f9c20 sp 0x7ffcbe8f93d0
READ of size 2 at 0x604000000731 thread T0
#0 0x7f528900486b (/usr/lib64/libasan.so.5+0xa486b)
#1 0x56ff5c in strip_comment libretro-common/file/config_file.c:162
#2 0x570d03 in parse_line libretro-common/file/config_file.c:341
#3 0x5715cf in config_file_new_internal libretro-common/file/config_file.c:463
#4 0x572133 in config_file_new libretro-common/file/config_file.c:618
#5 0x539ec1 in open_default_config_file /home/orbea/gittings/forks/RetroArch/configuration.c:2347
#6 0x53b025 in config_load_file /home/orbea/gittings/forks/RetroArch/configuration.c:2694
#7 0x53f8e1 in parse_config_file /home/orbea/gittings/forks/RetroArch/configuration.c:3789
#8 0x5407ec in config_load /home/orbea/gittings/forks/RetroArch/configuration.c:4021
#9 0x41f3ea in retroarch_parse_input_and_config /home/orbea/gittings/forks/RetroArch/retroarch.c:811
#10 0x420e3d in retroarch_main_init /home/orbea/gittings/forks/RetroArch/retroarch.c:1362
#11 0x448e7b in content_load tasks/task_content.c:281
#12 0x44bdf7 in task_load_content tasks/task_content.c:883
#13 0x450140 in task_load_content_callback tasks/task_content.c:1559
#14 0x4504c6 in task_push_load_content_from_cli tasks/task_content.c:1627
#15 0x41a56f in rarch_main frontend/frontend.c:125
#16 0x41a733 in main frontend/frontend.c:169
#17 0x7f5285652c66 in __libc_start_main (/lib64/libc.so.6+0x22c66)
#18 0x40fd59 in _start (/media/gittings/forks/RetroArch/retroarch+0x40fd59)
0x604000000731 is located 0 bytes to the right of 33-byte region [0x604000000710,0x604000000731)
allocated by thread T0 here:
#0 0x7f5289049320 in __interceptor_realloc (/usr/lib64/libasan.so.5+0xe9320)
#1 0x466db7 in filestream_getline libretro-common/streams/file_stream.c:594
#2 0x571558 in config_file_new_internal libretro-common/file/config_file.c:455
#3 0x572133 in config_file_new libretro-common/file/config_file.c:618
#4 0x539ec1 in open_default_config_file /home/orbea/gittings/forks/RetroArch/configuration.c:2347
#5 0x53b025 in config_load_file /home/orbea/gittings/forks/RetroArch/configuration.c:2694
#6 0x53f8e1 in parse_config_file /home/orbea/gittings/forks/RetroArch/configuration.c:3789
#7 0x5407ec in config_load /home/orbea/gittings/forks/RetroArch/configuration.c:4021
#8 0x41f3ea in retroarch_parse_input_and_config /home/orbea/gittings/forks/RetroArch/retroarch.c:811
#9 0x420e3d in retroarch_main_init /home/orbea/gittings/forks/RetroArch/retroarch.c:1362
#10 0x448e7b in content_load tasks/task_content.c:281
#11 0x44bdf7 in task_load_content tasks/task_content.c:883
#12 0x450140 in task_load_content_callback tasks/task_content.c:1559
#13 0x4504c6 in task_push_load_content_from_cli tasks/task_content.c:1627
#14 0x41a56f in rarch_main frontend/frontend.c:125
#15 0x41a733 in main frontend/frontend.c:169
#16 0x7f5285652c66 in __libc_start_main (/lib64/libc.so.6+0x22c66)
SUMMARY: AddressSanitizer: heap-buffer-overflow (/usr/lib64/libasan.so.5+0xa486b)
Shadow bytes around the buggy address:
0x0c087fff8090: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fd
0x0c087fff80a0: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fd
0x0c087fff80b0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fd
0x0c087fff80c0: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00 00
0x0c087fff80d0: fa fa 00 00 00 00 00 04 fa fa 00 00 00 00 00 04
=>0x0c087fff80e0: fa fa 00 00 00 00[01]fa fa fa fa fa fa fa fa fa
0x0c087fff80f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c087fff8100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c087fff8110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c087fff8120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x0c087fff8130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==30451==ABORTING
I accidentally left out a closing quote in a config file variable and then this happened:
We should probably find a way to simply ignore corrupt lines or something, instead of outright crashing.