The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: Mishasama on October 11, 2020, 08:16:36 PM

Title: [r9274] Error when expending the map.
Post by: Mishasama on October 11, 2020, 08:16:36 PM
pak 121 r2044 w/o addon
Added both the old sqai and the new sqai_rail.
Title: Re: [r9274] Error when expending the map.
Post by: prissi on October 11, 2020, 11:54:44 PM
This is not Scripterror, so I am not sure if this is due to the AI. Which climate generator did you use?
Title: Re: [r9274] Error when expending the map.
Post by: Mishasama on October 12, 2020, 10:44:19 AM
Quote from: prissi on October 11, 2020, 11:54:44 PM
This is not Scripterror, so I am not sure if this is due to the AI. Which climate generator did you use?
You guess right, the new humidity generator.
100% reproduce.
Title: Re: [r9274] Error when expending the map.
Post by: prissi on October 12, 2020, 01:36:08 PM
Halfway fixed in r9278. However, rotated map will not treated correctly (so we need to add anyway wind directions for this ...)

I noted that new rivers spawn everywhere, no only in new parts of the map.
Title: Re: [r9274] Error when expending the map.
Post by: Mishasama on October 13, 2020, 07:11:04 AM
Quote from: prissi on October 12, 2020, 01:36:08 PM
Halfway fixed in r9278. However, rotated map will not treated correctly (so we need to add anyway wind directions for this ...)

I noted that new rivers spawn everywhere, no only in new parts of the map.
r9278
It looks like something wrong.
Title: Re: [r9274] Error when expending the map.
Post by: ceeac on October 13, 2020, 08:08:44 AM
Also, the game still crashes when expanding the map in both x and y direction:

=================================================================
==4203==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x631000038800 at pc 0x0000010f47ec bp 0x7ffdf2e83bf0 sp 0x7ffdf2e83be8
READ of size 4 at 0x631000038800 thread T0
    #0 0x10f47eb in karte_t::calc_climate_map_region(short, short, short, short) /home/ceeac/Projects/code/simutrans/simworld.cc:6190:66
    #1 0x10e997d in karte_t::enlarge_map(settings_t const*, signed char const*) /home/ceeac/Projects/code/simutrans/simworld.cc:1960:3
    #2 0x8dfc61 in enlarge_map_frame_t::action_triggered(gui_action_creator_t*, value_t) /home/ceeac/Projects/code/simutrans/gui/enlarge_map_frame_t.cc:151:9
    #3 0x8dfe53 in non-virtual thunk to enlarge_map_frame_t::action_triggered(gui_action_creator_t*, value_t) /home/ceeac/Projects/code/simutrans/gui/enlarge_map_frame_t.cc
    #4 0x7c57f1 in gui_action_creator_t::call_listeners(value_t) /home/ceeac/Projects/code/simutrans/gui/components/gui_action_creator.h:32:11
    #5 0x7cafa1 in button_t::infowin_event(event_t const*) /home/ceeac/Projects/code/simutrans/gui/components/gui_button.cc:276:4
    #6 0x7e7f27 in gui_container_t::infowin_event(event_t const*) /home/ceeac/Projects/code/simutrans/gui/components/gui_container.cc:201:23
    #7 0x9156e9 in gui_frame_t::infowin_event(event_t const*) /home/ceeac/Projects/code/simutrans/gui/gui_frame.cc:132:34
    #8 0xa8cbf7 in check_pos_win(event_t*) /home/ceeac/Projects/code/simutrans/gui/simwin.cc:1521:20
    #9 0xfd3055 in interaction_t::process_event(event_t&) /home/ceeac/Projects/code/simutrans/siminteraction.cc:366:5
    #10 0xfd3b92 in interaction_t::check_events() /home/ceeac/Projects/code/simutrans/siminteraction.cc:439:7
    #11 0x1140c37 in karte_t::interactive(unsigned int) /home/ceeac/Projects/code/simutrans/simworld.cc:7167:17
    #12 0xff0356 in simu_main(int, char**) /home/ceeac/Projects/code/simutrans/simmain.cc:1472:9
    #13 0x122a54f in sysmain(int, char**) /home/ceeac/Projects/code/simutrans/sys/simsys.cc:1098:9
    #14 0x12b8741 in main /home/ceeac/Projects/code/simutrans/sys/simsys_s2.cc:790:9
    #15 0x7f98765970b2 in __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:308:16
    #16 0x42696d in _start (/media/ceeac/Projects/code/simutrans/build/default/sim+0x42696d)

0x631000038800 is located 0 bytes to the right of 65536-byte region [0x631000028800,0x631000038800)
allocated by thread T0 here:
    #0 0x4ce92d in operator new[](unsigned long) (/media/ceeac/Projects/code/simutrans/build/default/sim+0x4ce92d)
    #1 0x10f40e2 in karte_t::calc_climate_map_region(short, short, short, short) /home/ceeac/Projects/code/simutrans/simworld.cc:6172:34
    #2 0x10e997d in karte_t::enlarge_map(settings_t const*, signed char const*) /home/ceeac/Projects/code/simutrans/simworld.cc:1960:3
    #3 0x8dfc61 in enlarge_map_frame_t::action_triggered(gui_action_creator_t*, value_t) /home/ceeac/Projects/code/simutrans/gui/enlarge_map_frame_t.cc:151:9
    #4 0x8dfe53 in non-virtual thunk to enlarge_map_frame_t::action_triggered(gui_action_creator_t*, value_t) /home/ceeac/Projects/code/simutrans/gui/enlarge_map_frame_t.cc
    #5 0x7c57f1 in gui_action_creator_t::call_listeners(value_t) /home/ceeac/Projects/code/simutrans/gui/components/gui_action_creator.h:32:11
    #6 0x7cafa1 in button_t::infowin_event(event_t const*) /home/ceeac/Projects/code/simutrans/gui/components/gui_button.cc:276:4
    #7 0x7e7f27 in gui_container_t::infowin_event(event_t const*) /home/ceeac/Projects/code/simutrans/gui/components/gui_container.cc:201:23
    #8 0x9156e9 in gui_frame_t::infowin_event(event_t const*) /home/ceeac/Projects/code/simutrans/gui/gui_frame.cc:132:34
    #9 0xa8cbf7 in check_pos_win(event_t*) /home/ceeac/Projects/code/simutrans/gui/simwin.cc:1521:20
    #10 0xfd3055 in interaction_t::process_event(event_t&) /home/ceeac/Projects/code/simutrans/siminteraction.cc:366:5
    #11 0xfd3b92 in interaction_t::check_events() /home/ceeac/Projects/code/simutrans/siminteraction.cc:439:7
    #12 0x1140c37 in karte_t::interactive(unsigned int) /home/ceeac/Projects/code/simutrans/simworld.cc:7167:17
    #13 0xff0356 in simu_main(int, char**) /home/ceeac/Projects/code/simutrans/simmain.cc:1472:9
    #14 0x122a54f in sysmain(int, char**) /home/ceeac/Projects/code/simutrans/sys/simsys.cc:1098:9
    #15 0x12b8741 in main /home/ceeac/Projects/code/simutrans/sys/simsys_s2.cc:790:9
    #16 0x7f98765970b2 in __libc_start_main /build/glibc-ZN95T4/glibc-2.31/csu/../csu/libc-start.c:308:16

SUMMARY: AddressSanitizer: heap-buffer-overflow /home/ceeac/Projects/code/simutrans/simworld.cc:6190:66 in karte_t::calc_climate_map_region(short, short, short, short)
Shadow bytes around the buggy address:
  0x0c627ffff0b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c627ffff0c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c627ffff0d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c627ffff0e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x0c627ffff0f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x0c627ffff100:[fa]fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c627ffff110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c627ffff120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c627ffff130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c627ffff140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c627ffff150: 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
  Shadow gap:              cc
==4203==ABORTING
Title: Re: [r9274] Error when expending the map.
Post by: prissi on October 13, 2020, 01:51:18 PM
It works for me, also in both diredctions. Even mores since Simutrans checks the size of teh arrays for out of bound access. Also an overlow by 0 bytes is a strange error message. (Although there could be certainly more errors.)

Also I see just two entries in the Combobox.
Title: Re: [r9274] Error when expending the map.
Post by: Mishasama on October 13, 2020, 02:50:22 PM
Quote from: prissi on October 13, 2020, 01:51:18 PM
Also I see just two entries in the Combobox.
It only happens after starting the game then click new game.

And another problem...
Title: Re: [r9274] Error when expending the map.
Post by: Dwachs on October 13, 2020, 04:26:42 PM
I cannot reproduce any bad behavior either.

@ceaac: can you upload a savegame, where this fails?
Title: Re: [r9274] Error when expending the map.
Post by: ceeac on October 13, 2020, 05:25:56 PM
Not needed - I managed to fix the crash myself already. :) The issue was only present when expanding the map in both directions at the same time.
Title: Re: [r9274] Error when expending the map.
Post by: Dwachs on October 13, 2020, 05:39:08 PM
Thanks! I could not reproduce this since the climate-generator setting is not saved in the savegame, which is a bug of its own.

Edit: should be fixed in r9218.