Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
08486 Misc. Critical (emulator) Always Nov 4, 2022, 13:27 Nov 5, 2022, 14:50
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 156e64d Github Pull Request #
Summary 08486: all atari/blstroid.cpp sets: AddressSanitizer: heap-buffer-overflow
Description
==7978==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x621000117d50 at pc 0x7f4399296695 bp 0x7fffc8318f80 sp 0x7fffc8318f78
READ of size 2 at 0x621000117d50 thread T0
    #0 0x7f4399296694 in memory_array::read16_from_16(int) const /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/memarray.cpp:153:60
    #1 0x7f4377c8305e in read /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/memarray.h:66:37
    #2 0x7f4377c8305e in tilemap_device::basemem_read(unsigned int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/tilemap.h:747:53
    #3 0x7f4377e73925 in blstroid_state::scanline_update(timer_device&, int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/atari/blstroid_v.cpp:107:28
    #4 0x7f438f22177f in util::detail::delegate_base<delegate_late_bind, void, timer_device&, int>::operator()(timer_device&, int) const /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:765:11
    #5 0x7f438f21d93a in timer_device::scanline_tick(int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/machine/timer.cpp:175:4
    #6 0x7f43993df304 in operator() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:765:11
    #7 0x7f43993df304 in device_scheduler::execute_timers() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:951:5
    #8 0x7f43993da858 in device_scheduler::timeslice() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:505:2
    #9 0x7f43992724a7 in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:329:17
    #10 0x7f439c3d8f7f in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #11 0x7f439c5cd8d6 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
    #12 0x7f439c5d141f 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
    #13 0x7f439c3ddd5f 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
    #14 0x7f43995b458b in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #15 0x7f4357ab9209 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #16 0x7f4357ab92bb in __libc_start_main csu/../csu/libc-start.c:389:3
    #17 0x7f4376d3e260 in _start (/mnt/s/GitHub/mame/mame+0x1d397260) (BuildId: 603d3d1c300651feb2a8e3ac6e9cb58d3f85e77b)

0x621000117d50 is located 80 bytes to the right of 4096-byte region [0x621000116d00,0x621000117d00)
allocated by thread T0 here:
    #0 0x7f4376dc10ae in __interceptor_malloc (/mnt/s/GitHub/mame/mame+0x1d41a0ae) (BuildId: 603d3d1c300651feb2a8e3ac6e9cb58d3f85e77b)
    #1 0x7f4392c083f9 in memory_manager::allocate_memory(device_t&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned char, unsigned long) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.cpp:312:46
    #2 0x7f4392c09255 in memory_manager::share_alloc(device_t&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned char, unsigned long, util::endianness) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.cpp:378:14
    #3 0x7f4392c533be in address_space::prepare_map_generic(address_map&, bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem_aspace.cpp:809:23
    #4 0x7f4392c55d62 in address_space::prepare_map() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem_aspace.cpp:896:2
    #5 0x7f4392c2f3b7 in device_memory_interface::prepare_maps() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/dimemory.h:102:84
    #6 0x7f4392c07b1a in memory_manager::initialize() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.cpp:293:11
    #7 0x7f439926ebf5 in running_machine::start() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:183:11
    #8 0x7f43992720dc in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:281:3
    #9 0x7f439c3d8f7f in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #10 0x7f439c5cd8d6 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
    #11 0x7f439c5d141f 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
    #12 0x7f439c3ddd5f 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
    #13 0x7f43995b458b in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #14 0x7f4357ab9209 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/memarray.cpp:153:60 in memory_array::read16_from_16(int) const
Shadow bytes around the buggy address:
  0x0c428001af50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428001af60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428001af70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428001af80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428001af90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c428001afa0: fa fa fa fa fa fa fa fa fa fa[fa]fa fa fa fa fa
  0x0c428001afb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428001afc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428001afd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428001afe0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428001aff0: 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
Steps To Reproduce
Additional Information
Github Commit
Flags
Regression Version
Affected Sets / Systems all atari/blstroid.cpp sets
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
4
User avatar
No.20753
hap
Developer
Nov 5, 2022, 12:41
maybe fixed here: https://github.com/mamedev/mame/commit/85408be0396da6ab46fd29de5a4b441d09548123
User avatar
No.20758
Firewave
Senior Tester
Nov 5, 2022, 13:32
edited on: Nov 5, 2022, 14:49
Still happening:
==7096==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6210001a1550 at pc 0x7fe9954a2255 bp 0x7fffdc6e7ac0 sp 0x7fffdc6e7ab8
READ of size 2 at 0x6210001a1550 thread T0
    #0 0x7fe9954a2254 in memory_array::read16_from_16(int) const /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/memarray.cpp:153:60
    #1 0x7fe97020c4fe in read /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/memarray.h:66:37
    #2 0x7fe97020c4fe in tilemap_device::basemem_read(unsigned int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/tilemap.h:747:53
    #3 0x7fe9704417c5 in blstroid_state::scanline_update(timer_device&, int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/atari/blstroid_v.cpp:107:28
    #4 0x7fe98b5da66f in util::detail::delegate_base<delegate_late_bind, void, timer_device&, int>::operator()(timer_device&, int) const /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:765:11
    #5 0x7fe98b5d682a in timer_device::scanline_tick(int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/devices/machine/timer.cpp:175:4
    #6 0x7fe9955e7a64 in operator() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:765:11
    #7 0x7fe9955e7a64 in device_scheduler::execute_timers() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:951:5
    #8 0x7fe9955e29a8 in device_scheduler::timeslice() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:505:2
    #9 0x7fe99547f417 in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:329:17
    #10 0x7fe98d58f05f in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #11 0x7fe98e9463d6 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
    #12 0x7fe98e949f1f 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
    #13 0x7fe98d593e3f 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
    #14 0x7fe9957754ab in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #15 0x7fe9484b9209 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #16 0x7fe9484b92bb in __libc_start_main csu/../csu/libc-start.c:389:3
    #17 0x7fe96f105b90 in _start (/mnt/s/GitHub/mame/mame+0x24d5fb90) (BuildId: e793b6d6aa7d9772)

0x6210001a1550 is located 80 bytes to the right of 4096-byte region [0x6210001a0500,0x6210001a1500)
allocated by thread T0 here:
    #0 0x7fe96f1889de in malloc (/mnt/s/GitHub/mame/mame+0x24de29de) (BuildId: e793b6d6aa7d9772)
    #1 0x7fe98eda1009 in memory_manager::allocate_memory(device_t&, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned char, unsigned long) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.cpp:312:46
    #2 0x7fe98eda1e65 in memory_manager::share_alloc(device_t&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, unsigned char, unsigned long, util::endianness) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.cpp:378:14
    #3 0x7fe98edebfce in address_space::prepare_map_generic(address_map&, bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem_aspace.cpp:809:23
    #4 0x7fe98edee972 in address_space::prepare_map() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem_aspace.cpp:896:2
    #5 0x7fe98edc7fc7 in device_memory_interface::prepare_maps() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/dimemory.h:102:84
    #6 0x7fe98eda072a in memory_manager::initialize() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.cpp:293:11
    #7 0x7fe99547bb65 in running_machine::start() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:183:11
    #8 0x7fe99547f04c in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:281:3
    #9 0x7fe98d58f05f in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #10 0x7fe98e9463d6 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
    #11 0x7fe98e949f1f 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
    #12 0x7fe98d593e3f 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
    #13 0x7fe9957754ab in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #14 0x7fe9484b9209 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/memarray.cpp:153:60 in memory_array::read16_from_16(int) const
Shadow bytes around the buggy address:
  0x0c428002c250: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428002c260: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428002c270: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428002c280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428002c290: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c428002c2a0: fa fa fa fa fa fa fa fa fa fa[fa]fa fa fa fa fa
  0x0c428002c2b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428002c2c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428002c2d0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428002c2e0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428002c2f0: 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
User avatar
No.20762
hap
Developer
Nov 5, 2022, 13:55
Ah, i missed one check: https://github.com/mamedev/mame/commit/156e64d1629523b19d7fc6681aa62217c73028e3
User avatar
No.20765
Firewave
Senior Tester
Nov 5, 2022, 14:50
Cherry-picked and confirmed.