Viewing Issue Advanced Details
ID Category [?] Severity [?] Reproducibility Date Submitted Last Update
05865 Misc. Critical (emulator) Always Mar 5, 2015, 17:40 Nov 5, 2022, 09:03
Tester Firewave View Status Public Platform MAME (Self-compiled)
Assigned To Resolution Open OS
Status [?] Acknowledged Driver
Version 0.159 Fixed in Version Build Debug
Fixed in Git Commit Github Pull Request #
Summary 05865: nbbatman2bl: AddressSanitizer: heap-buffer-overflow with -aviwrite
Description
==20714==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000129430 at pc 0x00000579676e bp 0x7fff7f53e230 sp 0x7fff7f53e228
READ of size 4 at 0x625000129430 thread T0
    #0 0x579676d in rgb_t::operator unsigned int() const /home/notroot/trunk/src/lib/util/palette.h:59:28
    #1 0x579676d in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::get_texel_palette16(render_texinfo const&, int, int) /home/notroot/trunk/src/emu/rendersw.inc:157
    #2 0x579676d in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::draw_quad_palette16_none(render_primitive const&, unsigned int*, unsigned int, software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::quad_setup_data&) /home/notroot/trunk/src/emu/rendersw.inc:640
    #3 0x579556e in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::setup_and_draw_textured_quad(render_primitive const&, unsigned int*, int, int, unsigned int) /home/notroot/trunk/src/emu/rendersw.inc:1868:5
    #4 0x576dca8 in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::draw_primitives(render_primitive_list const&, void*, unsigned int, unsigned int, unsigned int) /home/notroot/trunk/src/emu/rendersw.inc:1936:7
    #5 0x81dcc7a in video_manager::create_snapshot_bitmap(screen_device*) /home/notroot/trunk/src/emu/video.c:1095:3
    #6 0x81deb69 in video_manager::record_frame() /home/notroot/trunk/src/emu/video.c:1243:2
    #7 0x81d94ab in video_manager::finish_screen_updates() /home/notroot/trunk/src/emu/video.c:664:3
    #8 0x81d853f in video_manager::frame_update(bool) /home/notroot/trunk/src/emu/video.c:202:27
    #9 0x813f362 in screen_device::vblank_begin() /home/notroot/trunk/src/emu/screen.c:822:3
    #10 0x813f029 in screen_device::device_timer(emu_timer&, unsigned int, int, void*) /home/notroot/trunk/src/emu/screen.c:404:4
    #11 0x8136b63 in device_t::timer_expired(emu_timer&, unsigned int, int, void*) /home/notroot/trunk/src/emu/device.h:191:83
    #12 0x8136b63 in device_scheduler::execute_timers() /home/notroot/trunk/src/emu/schedule.c:902
    #13 0x813263b in device_scheduler::timeslice() /home/notroot/trunk/src/emu/schedule.c:517:2
    #14 0x804fe48 in running_machine::run(bool) /home/notroot/trunk/src/emu/machine.c:397:5
    #15 0x8047ee6 in machine_manager::execute() /home/notroot/trunk/src/emu/mame.c:222:11
    #16 0x7e79dbc in cli_frontend::execute(int, char**) /home/notroot/trunk/src/emu/clifront.c:220:15
    #17 0x575d9bb in main /home/notroot/trunk/src/osd/sdl/sdlmain.c:322:9
    #18 0x7ff26f83fec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287
    #19 0x116cdfc in _start (/home/notroot/trunk/mame64d+0x116cdfc)

0x625000129430 is located 808 bytes to the right of 8200-byte region [0x625000127100,0x625000129108)
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 0x80cfbfd in operator new[](unsigned long, char const*, int) /home/notroot/trunk/src/lib/util/corealloc.h:72:125
    #4 0x80cfbfd in dynamic_array<rgb_t>::expand_internal(int) /home/notroot/trunk/src/lib/util/coretmpl.h:115
    #5 0x80cfbfd in dynamic_array<rgb_t>::resize(int) /home/notroot/trunk/src/lib/util/coretmpl.h:94
    #6 0x80cfbfd in render_container::bcg_lookup_table(int, palette_t*) /home/notroot/trunk/src/emu/render.c:728
    #7 0x80cf96c in render_texture::get_adjusted_palette(render_container&) /home/notroot/trunk/src/emu/render.c:546:11
    #8 0x80dc235 in render_target::add_container_primitives(render_primitive_list&, object_transform const&, render_container&, int) /home/notroot/trunk/src/emu/render.c:1739:30
    #9 0x80da1b6 in render_target::get_primitives() /home/notroot/trunk/src/emu/render.c:1320:7
    #10 0x81dcb2d in video_manager::create_snapshot_bitmap(screen_device*) /home/notroot/trunk/src/emu/video.c:1090:36
    #11 0x81deb69 in video_manager::record_frame() /home/notroot/trunk/src/emu/video.c:1243:2
    #12 0x81d94ab in video_manager::finish_screen_updates() /home/notroot/trunk/src/emu/video.c:664:3
    #13 0x81d853f in video_manager::frame_update(bool) /home/notroot/trunk/src/emu/video.c:202:27
    #14 0x813f362 in screen_device::vblank_begin() /home/notroot/trunk/src/emu/screen.c:822:3
    #15 0x813f029 in screen_device::device_timer(emu_timer&, unsigned int, int, void*) /home/notroot/trunk/src/emu/screen.c:404:4
    #16 0x8136b63 in device_t::timer_expired(emu_timer&, unsigned int, int, void*) /home/notroot/trunk/src/emu/device.h:191:83
    #17 0x8136b63 in device_scheduler::execute_timers() /home/notroot/trunk/src/emu/schedule.c:902
    #18 0x813263b in device_scheduler::timeslice() /home/notroot/trunk/src/emu/schedule.c:517:2
    #19 0x804fe48 in running_machine::run(bool) /home/notroot/trunk/src/emu/machine.c:397:5
    #20 0x8047ee6 in machine_manager::execute() /home/notroot/trunk/src/emu/mame.c:222:11
    #21 0x7e79dbc in cli_frontend::execute(int, char**) /home/notroot/trunk/src/emu/clifront.c:220:15
    #22 0x575d9bb in main /home/notroot/trunk/src/osd/sdl/sdlmain.c:322:9
    #23 0x7ff26f83fec4 in __libc_start_main /build/buildd/eglibc-2.19/csu/libc-start.c:287

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/notroot/trunk/src/lib/util/palette.h:59 rgb_t::operator unsigned int() const
Shadow bytes around the buggy address:
  0x0c4a8001d230: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8001d240: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8001d250: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8001d260: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8001d270: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c4a8001d280: fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa
  0x0c4a8001d290: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8001d2a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8001d2b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8001d2c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8001d2d0: 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
  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 nbbatman2bl
Attached Files
 
Relationships
There are no relationship linked to this issue.
Notes
3
User avatar
No.11505
B2K24
Senior Tester
Mar 11, 2015, 17:46
-----------------------------------------------------
Exception at EIP=0000000003DF9A2C (rgb_t::operator unsigned int() const+0x000c):
 ACCESS VIOLATION
While attempting to read memory at 0000000052314328
-----------------------------------------------------
RAX=0000000052314328 RBX=0000000000000140 RCX=0000000052314328 RDX=0000000000002
330
RSI=0000000000000140 RDI=00000000000000F0 RBP=0000000000227EB0 RSP=0000000000227
EB0
 R8=0000000000000000  R9=0000000000228050 R10=0000000000000000 R11=000000003FE00
000
R12=0000000000000028 R13=000000000000000A R14=0000000000000000 R15=0000000000000
000
-----------------------------------------------------
Stack crawl:
  0000000000227EB0: 0000000003DF9A2C (rgb_t::operator unsigned int() const+0x000
c)
  0000000000227F20: 0000000003B3E5D1 (software_renderer<unsigned int, 0, 0, 0, 1
6, 8, 0, false, true>::get_texel_palette16(render_texinfo const&, int, int)+0x01
01)
  0000000000228010: 0000000003B40A57 (software_renderer<unsigned int, 0, 0, 0, 1
6, 8, 0, false, true>::draw_quad_palette16_none(render_primitive const&, unsigne
d int*, unsigned int, software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false,
true>::quad_setup_data&)+0x01a7)
  00000000002280A0: 0000000003B42280 (software_renderer<unsigned int, 0, 0, 0, 1
6, 8, 0, false, true>::setup_and_draw_textured_quad(render_primitive const&, uns
igned int*, int, int, unsigned int)+0x0600)
  0000000000228100: 0000000003B3CAAF (software_renderer<unsigned int, 0, 0, 0, 1
6, 8, 0, false, true>::draw_primitives(render_primitive_list const&, void*, unsi
gned int, unsigned int, unsigned int)+0x00af)
  0000000000228190: 0000000002E5F7D0 (video_manager::create_snapshot_bitmap(scre
en_device*)+0x0258)
  0000000000228330: 0000000002E5FFBF (video_manager::record_frame()+0x009b)
  00000000002283A0: 0000000002E5E4FF (video_manager::finish_screen_updates()+0x0
119)
  0000000000228410: 0000000002E5CFAD (video_manager::frame_update(bool)+0x008d)
  00000000002284A0: 0000000002D2D160 (screen_device::vblank_begin()+0x00fa)
  00000000002284F0: 0000000002D2BB57 (screen_device::device_timer(emu_timer&, un
signed int, int, void*)+0x003d)
  0000000000228530: 0000000003D770E1 (device_t::timer_expired(emu_timer&, unsign
ed int, int, void*)+0x0041)
  0000000000228580: 0000000003AFA8AC (device_scheduler::execute_timers()+0x00fc)

  0000000000228640: 0000000002D2971E (device_scheduler::timeslice()+0x05ac)
  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.14590
Firewave
Senior Tester
Dec 31, 2017, 23:40
edited on: Jan 2, 2018, 23:43
Still happening in 0.193 (even without -aviwrite)

==117264==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62500042dc30 at pc 0x000008b6fab6 bp 0x7ffc4c898ed0 sp 0x7ffc4c898ec8
READ of size 4 at 0x62500042dc30 thread T0
    #0 0x8b6fab5 in operator unsigned int /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/palette.h:61:47
    #1 0x8b6fab5 in get_texel_palette16 /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/rendersw.hxx:157
    #2 0x8b6fab5 in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::draw_quad_palette16_none(render_primitive const&, unsigned int*, unsigned int, software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::quad_setup_data&) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/rendersw.hxx:628
    #3 0x8b6e518 in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::setup_and_draw_textured_quad(render_primitive const&, unsigned int*, int, int, unsigned int) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/rendersw.hxx:1880:5
    #4 0x8b5fa91 in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, false>::draw_primitives(render_primitive_list const&, void*, unsigned int, unsigned int, unsigned int) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/rendersw.hxx:1953:7
    #5 0x8b5d34d in renderer_sdl1::draw(int) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/render/drawsdl.cpp:423:5
    #6 0x8adf234 in sdl_window_info::update() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/window.cpp:629:17
    #7 0x8ad1d71 in sdl_osd_interface::update(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/video.cpp:108:12
    #8 0xe833517 in video_manager::frame_update(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:229:18
    #9 0xe7aa719 in screen_device::vblank_begin() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/screen.cpp:1524:21
    #10 0xe7a9c7c in screen_device::device_timer(emu_timer&, unsigned int, int, void*) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/screen.cpp:997:4
    #11 0xe795168 in timer_expired /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/device.h:520:83
    #12 0xe795168 in device_scheduler::execute_timers() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:906
    #13 0xe78ea0f in device_scheduler::timeslice() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:530:2
    #14 0xe6a324b in running_machine::run(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:357:17
    #15 0x8cd10e0 in mame_machine_manager::execute() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:236:19
    #16 0x8e1e0d3 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/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:257:22
    #17 0x8e20ee0 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/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:273:3
    #18 0x8cd3717 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/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:336:18
    #19 0x8acddf2 in main /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:216:9
    #20 0x7f1da4e5082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
    #21 0x1431838 in _start (/mnt/mame/mame64+0x1431838)

0x62500042dc30 is located 808 bytes to the right of 8200-byte region [0x62500042b900,0x62500042d908)
allocated by thread T0 here:
    #0 0x14fd722 in operator new(unsigned long) /opt/media/clang_nightly/llvm/utils/release/final/llvm.src/projects/compiler-rt/lib/asan/asan_new_delete.cc:92:3
    #1 0xe16c969 in allocate /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:104:27
    #2 0xe16c969 in allocate /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/alloc_traits.h:491
    #3 0xe16c969 in _M_allocate /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_vector.h:170
    #4 0xe16c969 in std::vector<rgb_t, std::allocator<rgb_t> >::_M_default_append(unsigned long) /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/vector.tcc:557
    #5 0xe6cf8b6 in resize /usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_vector.h:676:4
    #6 0xe6cf8b6 in render_container::bcg_lookup_table(int, palette_t*) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/render.cpp:718
    #7 0xe6dfd30 in render_target::add_container_primitives(render_primitive_list&, object_transform const&, object_transform const&, render_container&, int) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/bitmap.h
    #8 0xe6dc5b2 in render_target::get_primitives() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/render.cpp:1394:7
    #9 0x8b5df97 in renderer_sdl1::get_primitives() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/modules/render/drawsdl.cpp:691:25
    #10 0x8adeca5 in sdl_window_info::update() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/window.cpp:600:50
    #11 0x8ad1d71 in sdl_osd_interface::update(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/video.cpp:108:12
    #12 0xe833517 in video_manager::frame_update(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:229:18
    #13 0xe7aa719 in screen_device::vblank_begin() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/screen.cpp:1524:21
    #14 0xe7a9c7c in screen_device::device_timer(emu_timer&, unsigned int, int, void*) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/screen.cpp:997:4
    #15 0xe795168 in timer_expired /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/device.h:520:83
    #16 0xe795168 in device_scheduler::execute_timers() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:906
    #17 0xe78ea0f in device_scheduler::timeslice() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:530:2
    #18 0xe6a324b in running_machine::run(bool) /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:357:17
    #19 0x8cd10e0 in mame_machine_manager::execute() /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:236:19
    #20 0x8e1e0d3 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/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:257:22
    #21 0x8e20ee0 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/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/clifront.cpp:273:3
    #22 0x8cd3717 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/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:336:18
    #23 0x8acddf2 in main /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:216:9
    #24 0x7f1da4e5082f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)

SUMMARY: AddressSanitizer: heap-buffer-overflow /mnt/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/palette.h:61:47 in operator unsigned int
Shadow bytes around the buggy address:
  0x0c4a8007db30: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8007db40: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8007db50: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8007db60: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8007db70: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c4a8007db80: fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa
  0x0c4a8007db90: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8007dba0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8007dbb0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8007dbc0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a8007dbd0: 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
==117264==ABORTING 
User avatar
No.20733
Firewave
Senior Tester
Nov 5, 2022, 09:03
edited on: Nov 5, 2022, 09:07
This set is marked MNW so feel free to close it.

0.249 reports the following on Linux:
==1517==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x625000250430 at pc 0x7f76e66c36c8 bp 0x7fffff8f05c0 sp 0x7fffff8f05b8
READ of size 4 at 0x625000250430 thread T0
    #0 0x7f76e66c36c7 in operator unsigned int /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/palette.h:61:47
    #1 0x7f76e66c36c7 in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, true>::get_texel_palette16(render_texinfo const&, int, int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/rendersw.hxx:148:16
    #2 0x7f76e66a7066 in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, true>::draw_quad_palette16_none(render_primitive const&, unsigned int*, unsigned int, software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, true>::quad_setup_data const&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/rendersw.hxx:684:22
    #3 0x7f76e66a4ac3 in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, true>::setup_and_draw_textured_quad(render_primitive const&, unsigned int*, int, int, unsigned int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/rendersw.hxx:1782:5
    #4 0x7f76e669e382 in software_renderer<unsigned int, 0, 0, 0, 16, 8, 0, false, true>::draw_primitives(render_primitive_list const&, void*, unsigned int, unsigned int, unsigned int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/rendersw.hxx:1867:7
    #5 0x7f76e6697708 in video_manager::create_snapshot_bitmap(screen_device*) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:1046:3
    #6 0x7f76e669bb17 in video_manager::record_frame() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:1240:3
    #7 0x7f76e6692f86 in video_manager::finish_screen_updates() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:639:3
    #8 0x7f76e669190b in video_manager::frame_update(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:215:44
    #9 0x7f76e6588b78 in screen_device::vblank_begin(int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/screen.cpp:1646:21
    #10 0x7f76e65716b4 in operator() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:765:11
    #11 0x7f76e65716b4 in device_scheduler::execute_timers() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:951:5
    #12 0x7f76e656c5f8 in device_scheduler::timeslice() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:505:2
    #13 0x7f76e6409067 in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:329:17
    #14 0x7f76de518caf in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #15 0x7f76df8d0026 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
    #16 0x7f76df8d3b6f 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
    #17 0x7f76de51da8f 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
    #18 0x7f76e66ff0fb in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #19 0x7f7699439209 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #20 0x7f76994392bb in __libc_start_main csu/../csu/libc-start.c:389:3
    #21 0x7f76c008f120 in _start (/mnt/s/GitHub/mame/mame+0x24d60120) (BuildId: 7b7aeda5846ab501)

0x625000250430 is located 808 bytes to the right of 8200-byte region [0x62500024e100,0x625000250108)
allocated by thread T0 here:
    #0 0x7f76c014cdbd in operator new(unsigned long) (/mnt/s/GitHub/mame/mame+0x24e1ddbd) (BuildId: 7b7aeda5846ab501)
    #1 0x7f76ddf3347d in allocate /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/new_allocator.h:137:27
    #2 0x7f76ddf3347d in std::allocator_traits<std::allocator<rgb_t> >::allocate(std::allocator<rgb_t>&, unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/alloc_traits.h:464:20
    #3 0x7f76ddf6ed33 in _M_allocate /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:378:20
    #4 0x7f76ddf6ed33 in std::vector<rgb_t, std::allocator<rgb_t> >::_M_default_append(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/vector.tcc:650:34
    #5 0x7f76ddf66402 in std::vector<rgb_t, std::allocator<rgb_t> >::resize(unsigned long) /usr/bin/../lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_vector.h:1011:4
    #6 0x7f76e645494a in render_container::bcg_lookup_table(int, unsigned int&, palette_t*) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/render.cpp:691:17
    #7 0x7f76e64546cd in render_texture::get_adjusted_palette(render_container&, unsigned int&) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/render.cpp
    #8 0x7f76e645ee44 in render_target::add_container_primitives(render_primitive_list&, render_target::object_transform const&, render_target::object_transform const&, render_container&, int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/render.cpp:2384:49
    #9 0x7f76e645c3d1 in render_target::get_primitives() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/render.cpp:1427:5
    #10 0x7f76e66974c9 in video_manager::create_snapshot_bitmap(screen_device*) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:1043:51
    #11 0x7f76e669bb17 in video_manager::record_frame() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:1240:3
    #12 0x7f76e6692f86 in video_manager::finish_screen_updates() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:639:3
    #13 0x7f76e669190b in video_manager::frame_update(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/video.cpp:215:44
    #14 0x7f76e6588b78 in screen_device::vblank_begin(int) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/screen.cpp:1646:21
    #15 0x7f76e65716b4 in operator() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/lib/util/delegate.h:765:11
    #16 0x7f76e65716b4 in device_scheduler::execute_timers() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:951:5
    #17 0x7f76e656c5f8 in device_scheduler::timeslice() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/schedule.cpp:505:2
    #18 0x7f76e6409067 in running_machine::run(bool) /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/emu/machine.cpp:329:17
    #19 0x7f76de518caf in mame_machine_manager::execute() /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/frontend/mame/mame.cpp:290:19
    #20 0x7f76df8d0026 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
    #21 0x7f76df8d3b6f 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
    #22 0x7f76de51da8f 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
    #23 0x7f76e66ff0fb in main /mnt/s/GitHub/mame/build/projects/sdl/mame/gmake-linux-clang/../../../../../src/osd/sdl/sdlmain.cpp:191:9
    #24 0x7f7699439209 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/lib/util/palette.h:61:47 in operator unsigned int
Shadow bytes around the buggy address:
  0x0c4a80042030: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a80042040: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a80042050: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a80042060: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a80042070: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c4a80042080: fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa
  0x0c4a80042090: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a800420a0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a800420b0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a800420c0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c4a800420d0: 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