Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
05870 Misc. Critical (emulator) Always Mar 5, 2015, 17:52 Sep 25, 2019, 22:04
Tester Firewave View Status Public Platform MAME (Self-compiled)
Assigned To Kale Resolution Fixed OS
Status [?] Resolved Driver
Version 0.159 Fixed in Version 0.196 Build Debug
Fixed in Git Commit Github Pull Request #
Summary 05870: lastbrnx, lastbrnxu: AddressSanitizer: heap-use-after-free
Description
==26747==ERROR: AddressSanitizer: heap-use-after-free on address 0x7f85bc03c4a4 at pc 0x000003acc928 bp 0x7fffc6e96590 sp 0x7fffc6e96588
READ of size 4 at 0x7f85bc03c4a4 thread T0
    #0 0x3acc927 in geo_parse_nn_ns(geo_state*, unsigned int*, unsigned int) /home/notroot/trunk/src/mame/video/model2.c:1642:12
    #1 0x3acc927 in geo_object_data(geo_state*, unsigned int, unsigned int*) /home/notroot/trunk/src/mame/video/model2.c:2092
    #2 0x3ac3ceb in geo_process_command(geo_state*, unsigned int, unsigned int*) /home/notroot/trunk/src/mame/video/model2.c:2627:22
    #3 0x3ac3ceb in geo_parse(model2_state*) /home/notroot/trunk/src/mame/video/model2.c:2688
    #4 0x3ac3ceb in model2_state::screen_update_model2(screen_device&, bitmap_rgb32&, rectangle const&) /home/notroot/trunk/src/mame/video/model2.c:2740
    #5 0x813ffb0 in delegate_base<unsigned int, screen_device&, bitmap_rgb32&, rectangle const&, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam>::operator()(screen_device&, bitmap_rgb32&, rectangle const&) const /home/notroot/trunk/src/lib/util/delegate.h:652:76
    #6 0x813ffb0 in screen_device::update_partial(int) /home/notroot/trunk/src/emu/screen.c:625
    #7 0x81d8f52 in video_manager::finish_screen_updates() /home/notroot/trunk/src/emu/video.c:649:3
    #8 0x81d853f in video_manager::frame_update(bool) /home/notroot/trunk/src/emu/video.c:202:27
    #9 0x813f80c in screen_device::vblank_end() /home/notroot/trunk/src/emu/screen.c:856:3
    #10 0x813f036 in screen_device::device_timer(emu_timer&, unsigned int, int, void*) /home/notroot/trunk/src/emu/screen.c:409:4
    #11 0x8136b63 in device_t::timer_expired(emu_timer&, unsigned int, int, void*) /home/notroot/trunk/src/emu/device.h:191:83
    #12 0x8136b63 in device_scheduler::execute_timers() /home/notroot/trunk/src/emu/schedule.c:902
    #13 0x813263b in device_scheduler::timeslice() /home/notroot/trunk/src/emu/schedule.c:517:2
    #14 0x804fe48 in running_machine::run(bool) /home/notroot/trunk/src/emu/machine.c:397:5
    #15 0x8047ee6 in machine_manager::execute() /home/notroot/trunk/src/emu/mame.c:222:11
    #16 0x7e79dbc in cli_frontend::execute(int, char**) /home/notroot/trunk/src/emu/clifront.c:220:15
    #17 0x575d9bb in main /home/notroot/trunk/src/osd/sdl/sdlmain.c:322:9
    #18 0x7f85d2084ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
    #19 0x116cdfc in _start (/home/notroot/trunk/mame64d+0x116cdfc)

0x7f85bc03c4a4 is located 1735844 bytes inside of 4194304-byte region [0x7f85bbe94800,0x7f85bc294800)
freed by thread T0 here:
    #0 0x114f50b in free /home/ben/development/llvm/3.5/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:30:3
    #1 0x8b42548 in osd_free(void*) /home/notroot/trunk/src/osd/modules/lib/osdlib_unix.c:103:2
    #2 0x841a766 in free_file_line(void*, char const*, int, bool) /home/notroot/trunk/src/lib/util/corealloc.c:178:2
    #3 0x7f38d4d in operator delete[](void*) /home/notroot/trunk/src/lib/util/corealloc.h:66:87
    #4 0x7f38d4d in dynamic_array<unsigned char>::reset() /home/notroot/trunk/src/lib/util/coretmpl.h:93
    #5 0x7f38d4d in emu_file::close() /home/notroot/trunk/src/emu/fileio.c:412
    #6 0x7f389e1 in emu_file::~emu_file() /home/notroot/trunk/src/emu/fileio.c:185:2
    #7 0x7f38eae in emu_file::~emu_file() /home/notroot/trunk/src/emu/fileio.c:183:1
    #8 0x81208d3 in process_rom_entries(romload_private*, char const*, rom_entry const*, rom_entry const*, device_t*, bool) /home/notroot/trunk/src/emu/romload.c:1016:5
    #9 0x8124fb0 in process_region_list(romload_private*) /home/notroot/trunk/src/emu/romload.c:1498:5
    #10 0x8124fb0 in rom_init(running_machine&) /home/notroot/trunk/src/emu/romload.c:1565
    #11 0x804c2e0 in running_machine::start() /home/notroot/trunk/src/emu/machine.c:255:2
    #12 0x804fb73 in running_machine::run(bool) /home/notroot/trunk/src/emu/machine.c:351:3
    #13 0x8047ee6 in machine_manager::execute() /home/notroot/trunk/src/emu/mame.c:222:11
    #14 0x7e79dbc in cli_frontend::execute(int, char**) /home/notroot/trunk/src/emu/clifront.c:220:15
    #15 0x575d9bb in main /home/notroot/trunk/src/osd/sdl/sdlmain.c:322:9
    #16 0x7f85d2084ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287

previously allocated by thread T0 here:
    #0 0x114f78b in __interceptor_malloc /home/ben/development/llvm/3.5/final/llvm.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:40:3
    #1 0x8b42538 in osd_malloc_array(unsigned long) /home/notroot/trunk/src/osd/modules/lib/osdlib_unix.c:89:9
    #2 0x8419fca in malloc_file_line(unsigned long, char const*, int, bool, bool, bool) /home/notroot/trunk/src/lib/util/corealloc.c:112:25
    #3 0x7f3c40b in operator new[](unsigned long, char const*, int) /home/notroot/trunk/src/lib/util/corealloc.h:72:125
    #4 0x7f3c40b in dynamic_array<unsigned char>::expand_internal(int) /home/notroot/trunk/src/lib/util/coretmpl.h:115
    #5 0x7f3c40b in dynamic_array<unsigned char>::resize(int) /home/notroot/trunk/src/lib/util/coretmpl.h:94
    #6 0x7f3c40b in emu_file::load__7zped_file() /home/notroot/trunk/src/emu/fileio.c:887
    #7 0x7f3c006 in emu_file::attempt__7zped() /home/notroot/trunk/src/emu/fileio.c:867:64
    #8 0x7f39a76 in emu_file::open_next() /home/notroot/trunk/src/emu/fileio.c:367:13
    #9 0x7f3aaba in emu_file::open(char const*, unsigned int) /home/notroot/trunk/src/emu/fileio.c:311:9
    #10 0x7f3aaba in emu_file::open(char const*, char const*, char const*, unsigned int) /home/notroot/trunk/src/emu/fileio.c:325
    #11 0x8118f20 in common_process_file(emu_options&, char const*, bool, unsigned int, rom_entry const*, emu_file**) /home/notroot/trunk/src/emu/romload.c:113:12
    #12 0x811d7f6 in open_rom_file(romload_private*, char const*, rom_entry const*, astring&, bool) /home/notroot/trunk/src/emu/romload.c:645:12
    #13 0x811d7f6 in process_rom_entries(romload_private*, char const*, rom_entry const*, rom_entry const*, device_t*, bool) /home/notroot/trunk/src/emu/romload.c:970
    #14 0x8124fb0 in process_region_list(romload_private*) /home/notroot/trunk/src/emu/romload.c:1498:5
    #15 0x8124fb0 in rom_init(running_machine&) /home/notroot/trunk/src/emu/romload.c:1565
    #16 0x804c2e0 in running_machine::start() /home/notroot/trunk/src/emu/machine.c:255:2
    #17 0x804fb73 in running_machine::run(bool) /home/notroot/trunk/src/emu/machine.c:351:3
    #18 0x8047ee6 in machine_manager::execute() /home/notroot/trunk/src/emu/mame.c:222:11
    #19 0x7e79dbc in cli_frontend::execute(int, char**) /home/notroot/trunk/src/emu/clifront.c:220:15
    #20 0x575d9bb in main /home/notroot/trunk/src/osd/sdl/sdlmain.c:322:9
    #21 0x7f85d2084ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287

SUMMARY: AddressSanitizer: heap-use-after-free /home/notroot/trunk/src/mame/video/model2.c:1642 geo_parse_nn_ns(geo_state*, unsigned int*, unsigned int)
Shadow bytes around the buggy address:
  0x0ff1377ff840: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff850: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff860: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff870: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff880: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0ff1377ff890: fd fd fd fd[fd]fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff8a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff8b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff8c0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff8d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0ff1377ff8e0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
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
  Heap right redzone:      fb
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack partial redzone:   f4
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  ASan internal:           fe
Steps To Reproduce
Additional Information
Github Commit
Flags
Regression Version
Affected Sets / Systems lastbrnx, lastbrnxu
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
2
User avatar
No.11508
B2K24
Senior Tester
Mar 11, 2015, 18:17
-----------------------------------------------------
Exception at EIP=00000000015B1A39 (geo_code_upload(geo_state*, unsigned int, uns
igned int*)+0x0077): ACCESS VIOLATION
While attempting to read memory at 0000000054D83000
-----------------------------------------------------
RAX=0000000054D83000 RBX=0000000000001F14 RCX=0000000000228B98 RDX=0000000054D83
004
RSI=0000000000000001 RDI=0000000044855BF0 RBP=0000000000228200 RSP=0000000000228
1D0
 R8=00000000002281D8  R9=0000000000228130 R10=449D940046B61D00 R11=0000000058C3F
A58
R12=0000000000000018 R13=0000000000000012 R14=0000000000000000 R15=0000000000000
000
-----------------------------------------------------
Stack crawl:
  00000000002281D0: 00000000015B1A39 (geo_code_upload(geo_state*, unsigned int,
unsigned int*)+0x0077)
  0000000000228230: 00000000015B1E45 (geo_process_command(geo_state*, unsigned i
nt, unsigned int*)+0x03bd)
  0000000000228280: 00000000015B1F25 (geo_parse(model2_state*)+0x009b)
  00000000002282E0: 00000000015B2366 (model2_state::screen_update_model2(screen_
device&, bitmap_rgb32&, rectangle const&)+0x01ca)
  0000000000228310: 0000000003DC6615 (delegate_base<unsigned int, screen_device&
, bitmap_rgb32&, rectangle const&, _noparam, _noparam, _noparam, _noparam, _nopa
ram, _noparam, _noparam, _noparam, _noparam>::operator()(screen_device&, bitmap_
rgb32&, rectangle const&) const+0x0035)
  0000000000228380: 0000000002D2C7F4 (screen_device::update_partial(int)+0x0206)

  00000000002283F0: 0000000002E5E445 (video_manager::finish_screen_updates()+0x0
05f)
  0000000000228460: 0000000002E5CFAD (video_manager::frame_update(bool)+0x008d)
  00000000002284A0: 0000000002D2D370 (screen_device::vblank_end()+0x00e6)
  00000000002284F0: 0000000002D2BB65 (screen_device::device_timer(emu_timer&, un
signed int, int, void*)+0x004b)
  0000000000228530: 0000000003D770E1 (device_t::timer_expired(emu_timer&, unsign
ed int, int, void*)+0x0041)
  0000000000228580: 0000000003AFA8AC (device_scheduler::execute_timers()+0x00fc)

  0000000000228640: 0000000002D2971E (device_scheduler::timeslice()+0x05ac)
  0000000000228710: 0000000002D9A444 (running_machine::run(bool)+0x02b0)
  000000000022F4F0: 0000000002DA8E5A (machine_manager::execute()+0x01f8)
  000000000022F750: 0000000002E2CD7F (cli_frontend::execute(int, char**)+0x085f)

  000000000022FDF0: 000000000209B0D9 (utf8_main(int, char**)+0x020d)
  000000000022FE50: 0000000003131169 (wmain+0x00b9)
  000000000022FF20: 00000000004013CA (__tmainCRTStartup+0x024a)
  000000000022FF50: 00000000004014F8 (mainCRTStartup+0x0018)
  000000000022FF80: 0000000076A25A4D (BaseThreadInitThunk+0x000d)
  000000000022FFD0: 0000000076EBBA01 (RtlUserThreadStart+0x0021)
User avatar
No.16957
MetalGod
Senior Tester
Sep 24, 2019, 19:34
Tested in current mame 0.213 after leaving the game running in debug mode for more than 2 hours.
This is no longer happening.
Fixed