News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

[r10890] Crash on zoom

Started by ceeac, April 07, 2023, 06:52:47 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ceeac

I can reproduce the crash by loading a pak128 saved game and immediately zooming in and out repeatedly near the map border.

=================================================================
==4432==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61c0002bc738 at pc 0x000001291268 bp 0x7ffc3b64ae90 sp 0x7ffc3b64ae88
READ of size 4 at 0x61c0002bc738 thread T0
    #0 0x1291267 in mark_rect_dirty_nc(int, int, int, int) /home/ceeac/Projects/code/simutrans/src/simutrans/display/simgraph16.cc:1030:25
    #1 0x12af16c in display_rezoomed_img_alpha(unsigned int, unsigned int, unsigned int, int, int, signed char, unsigned int, bool, bool) /home/ceeac/Projects/code/simutrans/src/simutrans/display/simgraph16.cc:3334:5
    #2 0x6dd651 in grund_t::display_boden(short, short, short) const /home/ceeac/Projects/code/simutrans/src/simutrans/ground/grund.cc:1115:8
    #3 0x6b7d60 in main_view_t::display_region(koord, koord, short, short, bool) /home/ceeac/Projects/code/simutrans/src/simutrans/display/simview.cc:431:12
    #4 0x6b45ff in main_view_t::display(bool) /home/ceeac/Projects/code/simutrans/src/simutrans/display/simview.cc:268:2
    #5 0xf5f84f in intr_refresh_display(bool) /home/ceeac/Projects/code/simutrans/src/simutrans/simintr.cc:80:13
    #6 0x1152c36 in karte_t::display(unsigned int) /home/ceeac/Projects/code/simutrans/src/simutrans/world/simworld.cc:2680:2
    #7 0xf5fcaa in interrupt_check(char const*) /home/ceeac/Projects/code/simutrans/src/simutrans/simintr.cc:116:13
    #8 0x1159051 in karte_t::step() /home/ceeac/Projects/code/simutrans/src/simutrans/world/simworld.cc:3198:4
    #9 0x117590f in karte_t::interactive(unsigned int) /home/ceeac/Projects/code/simutrans/src/simutrans/world/simworld.cc:6187:6
    #10 0xf745a0 in simu_main(int, char**) /home/ceeac/Projects/code/simutrans/src/simutrans/simmain.cc:1681:9
    #11 0xf830aa in sysmain(int, char**) /home/ceeac/Projects/code/simutrans/src/simutrans/sys/simsys.cc:1156:9
    #12 0x7f7406f2bd8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #13 0x7f7406f2be3f in __libc_start_main csu/../csu/libc-start.c:392:3
    #14 0x43b384 in _start (/media/ceeac/Projects/code/simutrans/build/simutrans/simutrans+0x43b384)

0x61c0002bc738 is located 0 bytes to the right of 1720-byte region [0x61c0002bc080,0x61c0002bc738)
allocated by thread T0 here:
    #0 0x4b624d in malloc (/media/ceeac/Projects/code/simutrans/build/simutrans/simutrans+0x4b624d)
    #1 0xf77dab in xmalloc(unsigned long) /home/ceeac/Projects/code/simutrans/src/simutrans/simmem.cc:15:18

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/ceeac/Projects/code/simutrans/src/simutrans/display/simgraph16.cc:1030:25 in mark_rect_dirty_nc(int, int, int, int)
Shadow bytes around the buggy address:
  0x0c388004f890: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c388004f8a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c388004f8b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c388004f8c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c388004f8d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c388004f8e0: 00 00 00 00 00 00 00[fa]fa fa fa fa fa fa fa fa
  0x0c388004f8f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c388004f900: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c388004f910: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c388004f920: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c388004f930: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
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
  Shadow gap:              cc
==4432==ABORTING

ceeac

Should be fixed by r10891. The crash was not directly related to zoom but was related to displaying alpha blended images near the border of the main window.