Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
08497 Misc. Critical (emulator) Always Nov 4, 2022, 14:06 31 days ago
Tester Firewave View Status Public Platform MAME (Self-compiled)
Assigned To hap Resolution Fixed OS Linux (64-bit)
Status [?] Resolved Driver
Version 0.249 Fixed in Version 0.250 Build 64-bit
Fixed in Git Commit 742e1f8 Github Pull Request #
Summary 08497: hiimpact and clones, shimpact and clones: AddressSanitizer: heap-buffer-overflow
Description
==20291==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6040008af3fa at pc 0x7fd027005cbc bp 0x7fffc7f256c0 sp 0x7fffc7f256b8
READ of size 1 at 0x6040008af3fa thread T0
    #0 0x7fd027005cbb in handler_entry_read_memory<0, 0>::read(unsigned int, unsigned char) const /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem_hem.cpp:10:9
    #1 0x7fd013b825ee in emu::detail::handler_entry_size<0>::uX dispatch_read<0, 0, 0>(unsigned int, unsigned int, emu::detail::handler_entry_size<0>::uX, handler_entry_read<0, 0> const* const*) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.h:1570:47
    #2 0x7fd022eabee9 in handler_entry_read_dispatch<14, 0, 0>::read(unsigned int, unsigned char) const /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem_hedr.ipp:132:9
    #3 0x7fd00d5e3431 in emu::detail::handler_entry_size<0>::uX dispatch_read<1, 0, 0>(unsigned int, unsigned int, emu::detail::handler_entry_size<0>::uX, handler_entry_read<0, 0> const* const*) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.h:1570:47
    #4 0x7fd00e1e98e1 in read_native /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.h:1737:10
    #5 0x7fd00e1e98e1 in emu::detail::memory_access_specific<1, 0, 0, (util::endianness)1>::read_byte(unsigned int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.h:1643:66
    #6 0x7fd019b9bb9e in m6809_base_device::mi_default::read(unsigned short) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/cpu/m6809/m6809.cpp:581:17
    #7 0x7fd019b54be6 in m6809_base_device::read_memory(unsigned short) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/cpu/m6809/m6809.h:193:85
    #8 0x7fd019bc4a41 in read_operand /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/cpu/m6809/m6809inl.h:72:46
    #9 0x7fd019bc4a41 in m6809_base_device::execute_one() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../generated/emu/cpu/m6809/m6809.hxx:1240:15
    #10 0x7fd019b9ba5e in m6809_base_device::execute_run() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/cpu/m6809/m6809.cpp:574:3
    #11 0x7fd019b9bb1f in non-virtual thunk to m6809_base_device::execute_run() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/cpu/m6809/m6809.cpp
    #12 0x7fd027c95817 in run /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/diexec.h:190:15
    #13 0x7fd027c95817 in device_scheduler::timeslice() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:456:14
    #14 0x7fd027b2e4a7 in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:329:17
    #15 0x7fd02ac94f7f in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #16 0x7fd02ae898d6 in cli_frontend::start_execution(mame_machine_manager*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:275:22
    #17 0x7fd02ae8d41f in cli_frontend::execute(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:291:3
    #18 0x7fd02ac99d5f in emulator_info::start_frontend(emu_options&, osd_interface&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:454:18
    #19 0x7fd027e7058b in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #20 0x7fcfe6379209 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #21 0x7fcfe63792bb in __libc_start_main csu/../csu/libc-start.c:389:3
    #22 0x7fd0055fa260 in _start (/mnt/s/GitHub/mame/mame+0x1d397260) (BuildId: 603d3d1c300651feb2a8e3ac6e9cb58d3f85e77b)

0x6040008af3fa is located 0 bytes to the right of 42-byte region [0x6040008af3d0,0x6040008af3fa)
allocated by thread T0 here:
    #0 0x7fd0056b7f8d in operator new[](unsigned long) (/mnt/s/GitHub/mame/mame+0x1d454f8d) (BuildId: 603d3d1c300651feb2a8e3ac6e9cb58d3f85e77b)
    #1 0x7fd00caaf224 in make_unique<unsigned char[]> /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/unique_ptr.h:1080:30
    #2 0x7fd00caaf224 in midyunit_state::init_generic(int, int, int, int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/midway/midyunit_m.cpp:295:19
    #3 0x7fd00cab010d in midyunit_state::init_hiimpact() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/midway/midyunit_m.cpp:391:2
    #4 0x7fd00ca9d6cb in operator() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/midway/midyunit.cpp:3560:1
    #5 0x7fd00ca9d6cb in $_39::__invoke(device_t&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/midway/midyunit.cpp:3560:1
    #6 0x7fd0214bc68a in driver_device::device_start() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/driver.cpp:208:2
    #7 0x7fd02130a410 in device_t::start() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/device.cpp:562:2
    #8 0x7fd027b2d2df in running_machine::start_all_devices() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:1013:13
    #9 0x7fd027b2b2b4 in running_machine::start() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:211:2
    #10 0x7fd027b2e0dc in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:281:3
    #11 0x7fd02ac94f7f in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #12 0x7fd02ae898d6 in cli_frontend::start_execution(mame_machine_manager*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:275:22
    #13 0x7fd02ae8d41f in cli_frontend::execute(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:291:3
    #14 0x7fd02ac99d5f in emulator_info::start_frontend(emu_options&, osd_interface&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:454:18
    #15 0x7fd027e7058b in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #16 0x7fcfe6379209 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16

SUMMARY: AddressSanitizer: heap-buffer-overflow /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem_hem.cpp:10:9 in handler_entry_read_memory<0, 0>::read(unsigned int, unsigned char) const
Shadow bytes around the buggy address:
  0x0c088010de20: fa fa 00 00 00 00 07 fa fa fa 00 00 00 00 07 fa
  0x0c088010de30: fa fa 00 00 00 00 07 fa fa fa 00 00 00 00 07 fa
  0x0c088010de40: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 fa
  0x0c088010de50: fa fa 00 00 00 00 06 fa fa fa 00 00 00 00 00 fa
  0x0c088010de60: fa fa 00 00 00 00 06 fa fa fa 00 00 00 00 04 fa
=>0x0c088010de70: fa fa 00 00 00 00 01 fa fa fa 00 00 00 00 00[02]
  0x0c088010de80: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 fa
  0x0c088010de90: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 05
  0x0c088010dea0: fa fa 00 00 00 00 00 07 fa fa 00 00 00 00 00 07
  0x0c088010deb0: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 fa
  0x0c088010dec0: fa fa 00 00 00 00 00 fa fa fa 00 00 00 00 00 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
Steps To Reproduce
Additional Information
Github Commit
Flags
Regression Version
Affected Sets / Systems hiimpact and clones, shimpact and clones
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
2
User avatar
No.20751
hap
Developer
Nov 5, 2022, 11:24
maybe fixed here: https://github.com/mamedev/mame/commit/742e1f859ae368072b25bfa4782e37538cd26e35
User avatar
No.20754
Firewave
Senior Tester
31 days ago
Cherry-picked and fix confirmed.

I used the commit hash with the actual fix but that had a copy and paste so the fixed commit is actually https://github.com/mamedev/mame/commit/ae0f665decd69c8b4e7fdbb0ad0db5417fa5db55.