Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
05873 Misc. Critical (emulator) Always Mar 9, 2015, 10:43 21 days ago
Tester Firewave View Status Public Platform MAME (Self-compiled)
Assigned To Resolution Open OS Linux
Status [?] Confirmed Driver segas24.cpp
Version 0.159 Fixed in Version Build Debug
Fixed in Git Commit Github Pull Request #
Summary 05873: sspirtfc: AddressSanitizer: heap-use-after-free
Description
==31638==ERROR: AddressSanitizer: heap-use-after-free on address 0x7f396e2ba200 at pc 0x000003c89caa bp 0x7fff2c158b70 sp 0x7fff2c158b68
READ of size 1 at 0x7f396e2ba200 thread T0
    #0 0x3c89ca9 in segas24_state::fdc_w(address_space&, unsigned int, unsigned short, unsigned short) /home/notroot/trunk/src/mame/drivers/segas24.c:441:5
    #1 0x80b4dad in delegate_base<void, address_space&, unsigned int, unsigned short, unsigned short, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam>::operator()(address_space&, unsigned int, unsigned short, unsigned short) const /home/notroot/trunk/src/lib/util/delegate.h:653:88
    #2 0x80b4dad in handler_entry_write::write16(address_space&, unsigned int, unsigned short, unsigned short) const /home/notroot/trunk/src/emu/memory.c:421
    #3 0x80b4dad in address_space_specific<unsigned short, (endianness_t)1, true>::write_native(unsigned int, unsigned short, unsigned short) /home/notroot/trunk/src/emu/memory.c:1121
    #4 0x80b436b in void address_space_specific<unsigned short, (endianness_t)1, true>::write_direct<unsigned short, true>(unsigned int, unsigned short, unsigned short) /home/notroot/trunk/src/emu/memory.c:1286:11
    #5 0x80b436b in address_space_specific<unsigned short, (endianness_t)1, true>::write_word(unsigned int, unsigned short, unsigned short) /home/notroot/trunk/src/emu/memory.c:1428
    #6 0x67afafc in m68000_base_device::m68000_write_byte(unsigned int, unsigned char) /home/notroot/trunk/src/emu/cpu/m68000/m68kcpu.c:1300:2
    #7 0x68cc5a8 in delegate_base<void, unsigned int, unsigned char, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam>::operator()(unsigned int, unsigned char) const /home/notroot/trunk/src/lib/util/delegate.h:651:64
    #8 0x68cc5a8 in m68ki_write_8_fc(m68000_base_device*, unsigned int, unsigned int, unsigned int) /home/notroot/trunk/src/emu/cpu/m68000/m68kcpu.h:827
    #9 0x68cc5a8 in m68000_base_device_ops::m68k_op_move_8_di_d(m68000_base_device*) /home/notroot/trunk/obj/sdl64d/emu/cpu/m68000/m68kops.c:17072
    #10 0x67dace6 in m68000_base_device::cpu_execute() /home/notroot/trunk/src/emu/cpu/m68000/m68kcpu.c:861:5
    #11 0x67c48ff in m68000_base_device::execute_run() /home/notroot/trunk/src/emu/cpu/m68000/m68kcpu.c:2493:2
    #12 0x67c48ff in non-virtual thunk to m68000_base_device::execute_run() /home/notroot/trunk/src/emu/cpu/m68000/m68kcpu.c:2494
    #13 0x813206a in device_execute_interface::run() /home/notroot/trunk/src/emu/diexec.h:191:15
    #14 0x813206a in device_scheduler::timeslice() /home/notroot/trunk/src/emu/schedule.c:476
    #15 0x804fe48 in running_machine::run(bool) /home/notroot/trunk/src/emu/machine.c:397:5
    #16 0x8047ee6 in machine_manager::execute() /home/notroot/trunk/src/emu/mame.c:222:11
    #17 0x7e79dbc in cli_frontend::execute(int, char**) /home/notroot/trunk/src/emu/clifront.c:220:15
    #18 0x575d9bb in main /home/notroot/trunk/src/osd/sdl/sdlmain.c:322:9
    #19 0x7f397bb00ec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
    #20 0x116cdfc in _start (/home/notroot/trunk/mame64d+0x116cdfc)

0x7f396e2ba200 is located 14848 bytes inside of 131072-byte region [0x7f396e2b6800,0x7f396e2d6800)
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 0x8120404 in operator delete[](void*) /home/notroot/trunk/src/lib/util/corealloc.h:66:87
    #4 0x8120404 in dynamic_array<unsigned char>::reset() /home/notroot/trunk/src/lib/util/coretmpl.h:93
    #5 0x8120404 in dynamic_array<unsigned char>::~dynamic_array() /home/notroot/trunk/src/lib/util/coretmpl.h:78
    #6 0x8120404 in read_rom_data(romload_private*, rom_entry const*, rom_entry const*) /home/notroot/trunk/src/emu/romload.c:870
    #7 0x8120404 in process_rom_entries(romload_private*, char const*, rom_entry const*, rom_entry const*, device_t*, bool) /home/notroot/trunk/src/emu/romload.c:992
    #8 0x8124fb0 in process_region_list(romload_private*) /home/notroot/trunk/src/emu/romload.c:1498:5
    #9 0x8124fb0 in rom_init(running_machine&) /home/notroot/trunk/src/emu/romload.c:1565
    #10 0x804c2e0 in running_machine::start() /home/notroot/trunk/src/emu/machine.c:255:2
    #11 0x804fb73 in running_machine::run(bool) /home/notroot/trunk/src/emu/machine.c:351:3
    #12 0x8047ee6 in machine_manager::execute() /home/notroot/trunk/src/emu/mame.c:222:11
    #13 0x7e79dbc in cli_frontend::execute(int, char**) /home/notroot/trunk/src/emu/clifront.c:220:15
    #14 0x575d9bb in main /home/notroot/trunk/src/osd/sdl/sdlmain.c:322:9
    #15 0x7f397bb00ec4 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 0x811e5cc in operator new[](unsigned long, char const*, int) /home/notroot/trunk/src/lib/util/corealloc.h:72:125
    #4 0x811e5cc in dynamic_array<unsigned char>::expand_internal(int) /home/notroot/trunk/src/lib/util/coretmpl.h:115
    #5 0x811e5cc in dynamic_array<unsigned char>::dynamic_array(int, int) /home/notroot/trunk/src/lib/util/coretmpl.h:77
    #6 0x811e5cc in read_rom_data(romload_private*, rom_entry const*, rom_entry const*) /home/notroot/trunk/src/emu/romload.c:795
    #7 0x811e5cc in process_rom_entries(romload_private*, char const*, rom_entry const*, rom_entry const*, device_t*, bool) /home/notroot/trunk/src/emu/romload.c:992
    #8 0x8124fb0 in process_region_list(romload_private*) /home/notroot/trunk/src/emu/romload.c:1498:5
    #9 0x8124fb0 in rom_init(running_machine&) /home/notroot/trunk/src/emu/romload.c:1565
    #10 0x804c2e0 in running_machine::start() /home/notroot/trunk/src/emu/machine.c:255:2
    #11 0x804fb73 in running_machine::run(bool) /home/notroot/trunk/src/emu/machine.c:351:3
    #12 0x8047ee6 in machine_manager::execute() /home/notroot/trunk/src/emu/mame.c:222:11
    #13 0x7e79dbc in cli_frontend::execute(int, char**) /home/notroot/trunk/src/emu/clifront.c:220:15
    #14 0x575d9bb in main /home/notroot/trunk/src/osd/sdl/sdlmain.c:322:9
    #15 0x7f397bb00ec4 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/drivers/segas24.c:441 segas24_state::fdc_w(address_space&, unsigned int, unsigned short, unsigned short)
Shadow bytes around the buggy address:
  0x0fe7adc4f3f0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f400: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f410: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f420: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f430: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0fe7adc4f440:[fd]fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f450: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f460: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f470: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f480: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0fe7adc4f490: 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 sspirtfc
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
2
User avatar
No.11509
B2K24
Moderator
Mar 11, 2015, 18:36
-----------------------------------------------------
Exception at EIP=00000000014DA334 (segas24_state::fdc_w(address_space&, unsigned
 int, unsigned short, unsigned short)+0x027e): ACCESS VIOLATION
While attempting to read memory at 000000004DB69A00
-----------------------------------------------------
RAX=000000004DB69A00 RBX=0000000000B00001 RCX=00000000000000A2 RDX=0000000000002
D00
RSI=0000000000000001 RDI=0000000000395BF0 RBP=0000000000228220 RSP=0000000000228
1E0
 R8=000000004D9A2000  R9=0000000000000006 R10=0000000000000000 R11=0000000000228
17D
R12=0000000000000018 R13=0000000000000012 R14=0000000000000000 R15=0000000000000
000
-----------------------------------------------------
Stack crawl:
  00000000002281E0: 00000000014DA334 (segas24_state::fdc_w(address_space&, unsig
ned int, unsigned short, unsigned short)+0x027e)
  0000000000228270: 0000000003DC8F6D (delegate_base<void, address_space&, unsign
ed int, unsigned short, unsigned short, _noparam, _noparam, _noparam, _noparam,
_noparam, _noparam, _noparam, _noparam>::operator()(address_space&, unsigned int
, unsigned short, unsigned short) const+0x004d)
  00000000002282C0: 0000000003DF089A (handler_entry_write::write16(address_space
&, unsigned int, unsigned short, unsigned short) const+0x004a)
  0000000000228320: 0000000003BE5424 (address_space_specific<unsigned short, (en
dianness_t)1, true>::write_native(unsigned int, unsigned short, unsigned short)+
0x00e4)
  0000000000228360: 0000000003BE500A (void address_space_specific<unsigned short
, (endianness_t)1, true>::write_direct<unsigned short, true>(unsigned int, unsig
ned short, unsigned short)+0x004a)
  0000000000228390: 0000000003BE41F9 (address_space_specific<unsigned short, (en
dianness_t)1, true>::write_word(unsigned int, unsigned short, unsigned short)+0x
0039)
  00000000002283C0: 0000000002178A4D (m68000_base_device::m68000_write_byte(unsi
gned int, unsigned char)+0x0071)
  00000000002283F0: 0000000003DCB43E (delegate_base<void, unsigned int, unsigned
 char, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _noparam, _no
param, _noparam, _noparam>::operator()(unsigned int, unsigned char) const+0x002e
)
  0000000000228420: 0000000002A65E69 (m68ki_write_8_fc(m68000_base_device*, unsi
gned int, unsigned int, unsigned int)+0x0052)
  0000000000228470: 0000000002A9E9DC (m68000_base_device_ops::m68k_op_move_8_di_
d(m68000_base_device*)+0x0094)
  0000000000228520: 0000000003B6A087 (m68000_base_device::cpu_execute()+0x01d7)
  0000000000228550: 000000000217D501 (m68000_base_device::execute_run()+0x0015)
  0000000000228580: 0000000003BFF882 (device_execute_interface::run()+0x0022)
  0000000000228640: 0000000002D29488 (device_scheduler::timeslice()+0x0316)
  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.18433
Osso
Developer
21 days ago
edited on: 21 days ago
I think I fixed this, but I don't use AddressSanitizer. If someone can check..