Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
08484 Misc. Critical (emulator) Always Nov 4, 2022, 13:25 Nov 11, 2022, 13:41
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 f346392 Github Pull Request #
Summary 08484: bomblord, dynablstb, dynablstb2, dynablstb3, dynablstb4: AddressSanitizer: heap-buffer-overflow
Description
==8246==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x6210005164f2 at pc 0x7fda55e954ff bp 0x7fffefec4840 sp 0x7fffefec4838
READ of size 2 at 0x6210005164f2 thread T0
    #0 0x7fda55e954fe in m90_state::bomblord_draw_sprites(screen_device&, bitmap_ind16&, rectangle const&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/irem/m90_v.cpp:161:12
    #1 0x7fda55ea0f8d in m90_state::screen_update_bomblord(screen_device&, bitmap_ind16&, rectangle const&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/mame/irem/m90_v.cpp:451:2
    #2 0x7fda72e9f56d in util::detail::delegate_base<delegate_late_bind, unsigned int, screen_device&, bitmap_ind16&, rectangle const&>::operator()(screen_device&, bitmap_ind16&, rectangle const&) const /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:765:11
    #3 0x7fda72e8f386 in screen_device::update_partial(int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/screen.cpp:1215:41
    #4 0x7fda72f8cbc9 in video_manager::finish_screen_updates() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:622:10
    #5 0x7fda72f8b9cb in video_manager::frame_update(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:215:44
    #6 0x7fda72e857c8 in screen_device::vblank_begin(int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/screen.cpp:1646:21
    #7 0x7fda72e6e304 in operator() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:765:11
    #8 0x7fda72e6e304 in device_scheduler::execute_timers() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:951:5
    #9 0x7fda72e69858 in device_scheduler::timeslice() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:505:2
    #10 0x7fda72d014a7 in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:329:17
    #11 0x7fda75e67f7f in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #12 0x7fda7605c8d6 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 0x7fda7606041f 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 0x7fda75e6cd5f 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 0x7fda7304358b in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #16 0x7fda31549209 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #17 0x7fda315492bb in __libc_start_main csu/../csu/libc-start.c:389:3
    #18 0x7fda507cd260 in _start (/mnt/s/GitHub/mame/mame+0x1d397260) (BuildId: 603d3d1c300651feb2a8e3ac6e9cb58d3f85e77b)

0x6210005164f2 is located 0 bytes to the right of 4082-byte region [0x621000515500,0x6210005164f2)
allocated by thread T0 here:
    #0 0x7fda508500ae in __interceptor_malloc (/mnt/s/GitHub/mame/mame+0x1d41a0ae) (BuildId: 603d3d1c300651feb2a8e3ac6e9cb58d3f85e77b)
    #1 0x7fda6c6973f9 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 0x7fda6c698255 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 0x7fda6c6e23be 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 0x7fda6c6e4d62 in address_space::prepare_map() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem_aspace.cpp:896:2
    #5 0x7fda6c6be3b7 in device_memory_interface::prepare_maps() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/dimemory.h:102:84
    #6 0x7fda6c696b1a in memory_manager::initialize() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/emumem.cpp:293:11
    #7 0x7fda72cfdbf5 in running_machine::start() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:183:11
    #8 0x7fda72d010dc in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:281:3
    #9 0x7fda75e67f7f in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #10 0x7fda7605c8d6 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 0x7fda7606041f 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 0x7fda75e6cd5f 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 0x7fda7304358b in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #14 0x7fda31549209 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/mame/irem/m90_v.cpp:161:12 in m90_state::bomblord_draw_sprites(screen_device&, bitmap_ind16&, rectangle const&)
Shadow bytes around the buggy address:
  0x0c428009ac40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428009ac50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428009ac60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428009ac70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c428009ac80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c428009ac90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00[02]fa
  0x0c428009aca0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428009acb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428009acc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428009acd0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c428009ace0: 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 bomblord, dynablstb, dynablstb2, dynablstb3, dynablstb4
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
2
User avatar
No.20790
Firewave
Senior Tester
Nov 10, 2022, 11:08
edited on: Nov 10, 2022, 14:48
The spriteram has a size of 4082 bytes which is not a multiple of 4 - so the loop in m90_state::bomblord_draw_sprites() which iterates by 4 will go out of bounds.
User avatar
No.20796
hap
Developer
Nov 10, 2022, 22:11
probably fixed here: https://github.com/mamedev/mame/commit/f34639226c91d32d0b55eab9c377c98869fb951a