Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
08655 Crash/Freeze Critical (emulator) Always Jun 1, 2023, 13:36 2 days ago
Tester Robbbert View Status Public Platform MAME (Self-compiled)
Assigned To Resolution Open OS
Status [?] Confirmed Driver
Version 0.255 Fixed in Version Build
Fixed in Git Commit Github Pull Request #
Summary 08655: lsrquizg: Crash on exit.
Description At exit, the game crashes.
Steps To Reproduce Start the game. Let it get into attract mode. Press Esc.

C:\MAME>mame lsrquizg
laserquizgreek2pro.chd CHD NEEDS REDUMP
WARNING: the machine might not run correctly.
Average speed: 100.03% (1 seconds)

-----------------------------------------------------
Exception at EIP=00007ff63d875b56 (microtouch_device::~microtouch_device()+0x0146): ACCESS VIOLATION
While attempting to read memory at ffffffffffffffff
-----------------------------------------------------
RAX=34206f636e616220 RBX=000001fda6c8c5c0 RCX=0000000000000003 RDX=000001fda45269c8
RSI=000001fda5c75ae0 RDI=0000000000000000 RBP=00000005ae929d80 RSP=00000005ae929c20
 R8=0000000000000000 R9=0000000000000001 R10=0000000000008000 R11=00000005ae929b80
R12=000001fda6c8c5a0 R13=000001fda45264d0 R14=000001fda45269f8 R15=0000000000000000
-----------------------------------------------------
Stack crawl:
  00000005ae929c60: 00007ff63d875b56 (microtouch_device::~microtouch_device()+0x0146)
  00000005ae929ca0: 00007ff63d543eca (device_t::~device_t()+0x028a)
  00000005ae929ce0: 00007ff6391d6bfb ((anonymous namespace)::cubo_state::~cubo_state()+0x03bb)
  00000005ae92f210: 00007ff640ca9407 (mame_machine_manager::execute()+0x0177)
  00000005ae92f600: 00007ff644d38d76 (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&)+0x03e6)
  00000005ae92f8e0: 00007ff644d3939b (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> > > >&)+0x007b)
  00000005ae92f940: 00007ff640ca3c99 (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> > > >&)+0x0029)
  00000005ae92fd00: 00007ff6468b9863 (luaopen_lfs+0xb64c23)
  00000005ae92fdd0: 00007ff6390213b1 (__tmainCRTStartup+0x0231)
  00000005ae92fe00: 00007ff6390214e6 (mainCRTStartup+0x0016)
  00000005ae92fe30: 00007ff8fbfb7614 (BaseThreadInitThunk+0x0014)
  00000005ae92feb0: 00007ff8fd7826a1 (RtlUserThreadStart+0x0021)
Additional Information Game is MNW (most likely because of bad gfx), but it shouldn't crash.
Github Commit
Flags Noted in Source
Regression Version
Affected Sets / Systems lsrquizg
Attached Files
 
Relationships
related to 09051Acknowledged  haremchl: Potential segmentation fault when exiting emulation 
Notes
5
User avatar
No.21489
Balthier
Tester
Jun 1, 2023, 18:10
It's already noted in the driver if you had looked:
https://github.com/mamedev/mame/blob/master/src/mame/amiga/cubo.cpp#L12

   - lsrquiz2i, lsrquizg: access violation on microtouch_device destructor when exiting emulation
                          Caused by microtouch_device::rcv_complete() overrunning the m_rx_buffer
                          array space with 149 (array size=16).
User avatar
No.24222
Robbbert
Moderator
Mar 7, 2026, 05:00
Newly-added trumpfas also crash on exit with same issue.
User avatar
No.24525
Robbbert
Moderator
5 days ago
After waiting for a few years, I made a 2-line patch in my build to stop the buffer overflow, and the subsequent crash.
User avatar
No.24533
Firewave
Senior Tester
2 days ago
Running 0.289 on Linux:
==151020==ERROR: AddressSanitizer: SEGV on unknown address (pc 0x5645d4e8b990 bp 0x206f706f440a3036 sp 0x7ffd714531e0 T0)
==151020==The signal is caused by a READ memory access.
==151020==Hint: this fault was caused by a dereference of a high value address (see register values below).  Disassemble the provided pc to learn which register was used.
    #0 0x5645d4e8b990 in ~unique_ptr /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/bits/unique_ptr.h:407:6
    #1 0x5645d4e8b990 in destroy_at<std::unique_ptr<devcb_write<int, 1U>::creator, std::default_delete<devcb_write<int, 1U>::creator> > > /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/bits/stl_construct.h:88:15
    #2 0x5645d4e8b990 in _Destroy<std::unique_ptr<devcb_write<int, 1U>::creator, std::default_delete<devcb_write<int, 1U>::creator> > > /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/bits/stl_construct.h:164:7
    #3 0x5645d4e8b990 in _Destroy<std::unique_ptr<devcb_write<int, 1U>::creator, std::default_delete<devcb_write<int, 1U>::creator> > *> /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/bits/stl_construct.h:226:4
    #4 0x5645d4e8b990 in _Destroy<std::unique_ptr<devcb_write<int, 1U>::creator, std::default_delete<devcb_write<int, 1U>::creator> > *, std::unique_ptr<devcb_write<int, 1U>::creator, std::default_delete<devcb_write<int, 1U>::creator> > > /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/bits/alloc_traits.h:1085:7
    #5 0x5645d4e8b990 in ~vector /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/bits/stl_vector.h:792:2
    #6 0x5645d4e8b990 in ~devcb_write /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/devcb.h:2450:23
    #7 0x5645d4e8b990 in microtouch_device::~microtouch_device() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/machine/microtch.h:10:7
    #8 0x5645d4e8bc38 in microtouch_device::~microtouch_device() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/machine/microtch.h:10:7
    #9 0x5645d77f43b2 in remove /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/coretmpl.h:251:3
    #10 0x5645d77f43b2 in reset /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/coretmpl.h:98:4
    #11 0x5645d77f43b2 in ~simple_list /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/coretmpl.h:67:28
    #12 0x5645d77f43b2 in ~subdevice_list /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/device.h:484:8
    #13 0x5645d77f43b2 in device_t::~device_t() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/device.cpp:132:1
    #14 0x5645bb9562a8 in (anonymous namespace)::cubo_state::~cubo_state() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/amiga/cubo.cpp:334:7
    #15 0x5645db1df593 in operator() /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/bits/unique_ptr.h:92:2
    #16 0x5645db1df593 in ~unique_ptr /usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/16/../../../../include/c++/16/bits/unique_ptr.h:408:4
    #17 0x5645db1df593 in machine_config::~machine_config() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/mconfig.cpp:119:1
    #18 0x5645d663ff26 in mame_machine_manager::execute() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:312:2
    #19 0x5645d74cab2c 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&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:278:22
    #20 0x5645d74cd541 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>>>>&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:294:3
    #21 0x5645d6642c4d 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>>>>&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:453:18
    #22 0x5645db455a4b in main /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:100:9
    #23 0x7fa4bf427740 in __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:59:16
    #24 0x7fa4bf427878 in __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:360:3
    #25 0x5645bb287164 in _start (/home/user/CLionProjects/mame/mame-asan+0x11598164) (BuildId: 13beb3120a836eda0c05eca94b4a95e9bd4778da)

==151020==Register values:
rax = 0x00000fa89763f399  rbx = 0x00007d44bb1f9880  rcx = 0x00007d44bb1f9cc0  rdx = 0x0000000000000031  
rdi = 0x00007d44bb1f9cc8  rsi = 0x00000000000000fd  rbp = 0x206f706f440a3036  rsp = 0x00007ffd714531e0  
 r8 = 0x00007fa4bbbe8000   r9 = 0x0000000000012618  r10 = 0x0000000000100000  r11 = 0x00005645e54c155c  
r12 = 0x00000fa89763f398  r13 = 0x040dee0e6880c606  r14 = 0x206f706f440a3036  r15 = 0x2e2e2e6f62727574  
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/devcb.h:2450:23 in ~devcb_write
User avatar
No.24547
Firewave
Senior Tester
2 days ago
Probably the result of memory thrashing:
../../../../../src/devices/machine/microtch.cpp:290:2: runtime error: index 16 out of bounds for type 'uint8_t[16]' (aka 'unsigned char[16]')
    #0 0x562eb567e33c in microtouch_device::rcv_complete() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/machine/microtch.cpp:290:31
    #1 0x562eb6f1fbe5 in rcv_edge /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/diserial.cpp:126:3
    #2 0x562eb6f1fbe5 in rx_clock_w /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/diserial.cpp:146:4
    #3 0x562eb6f1fbe5 in device_serial_interface::rcv_clock(int) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/diserial.h:130:37
    #4 0x562eb91bb553 in operator() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:753:10
    #5 0x562eb91bb553 in device_scheduler::execute_timers() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:959:5
    #6 0x562eb91b9919 in device_scheduler::timeslice() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:505:2
    #7 0x562eb911d1d7 in running_machine::run(bool) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:415:17
    #8 0x562eb64a913a in mame_machine_manager::execute() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:288:19
    #9 0x562eb6db1d84 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&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:278:22
    #10 0x562eb6db331b 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>>>>&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:294:3
    #11 0x562eb64aa7d5 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>>>>&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:453:18
    #12 0x562eb928a2d5 in main /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:100:9
    #13 0x7ff54f427740 in __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:59:16
    #14 0x7ff54f427878 in __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:360:3
    #15 0x562ea83bca64 in _start (/home/user/CLionProjects/mame/mame-ubsan+0xecf7a64) (BuildId: e32754c153b25fe5b19784c0fd8f49b493dfc1e5)

SUMMARY: UndefinedBehaviorSanitizer: out-of-bounds-index ../../../../../src/devices/machine/microtch.cpp:290:2
../../../../../src/devices/machine/microtch.cpp:295:29: runtime error: index 115 out of bounds for type 'uint8_t[16]' (aka 'unsigned char[16]')
    #0 0x562eb567e390 in microtouch_device::rcv_complete() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/machine/microtch.cpp:295:29
    #1 0x562eb6f1fbe5 in rcv_edge /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/diserial.cpp:126:3
    #2 0x562eb6f1fbe5 in rx_clock_w /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/diserial.cpp:146:4
    #3 0x562eb6f1fbe5 in device_serial_interface::rcv_clock(int) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/diserial.h:130:37
    #4 0x562eb91bb553 in operator() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:753:10
    #5 0x562eb91bb553 in device_scheduler::execute_timers() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:959:5
    #6 0x562eb91b9919 in device_scheduler::timeslice() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:505:2
    #7 0x562eb911d1d7 in running_machine::run(bool) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:415:17
    #8 0x562eb64a913a in mame_machine_manager::execute() /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:288:19
    #9 0x562eb6db1d84 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&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:278:22
    #10 0x562eb6db331b 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>>>>&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:294:3
    #11 0x562eb64aa7d5 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>>>>&) /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:453:18
    #12 0x562eb928a2d5 in main /home/user/CLionProjects/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:100:9
    #13 0x7ff54f427740 in __libc_start_call_main /usr/src/debug/glibc/glibc/csu/../sysdeps/nptl/libc_start_call_main.h:59:16
    #14 0x7ff54f427878 in __libc_start_main /usr/src/debug/glibc/glibc/csu/../csu/libc-start.c:360:3
    #15 0x562ea83bca64 in _start (/home/user/CLionProjects/mame/mame-ubsan+0xecf7a64) (BuildId: e32754c153b25fe5b19784c0fd8f49b493dfc1e5)

SUMMARY: UndefinedBehaviorSanitizer: out-of-bounds-index ../../../../../src/devices/machine/microtch.cpp:295:29