News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

[r10470] Stack overflow when loading maps with large power nets

Started by ceeac, February 07, 2022, 08:16:30 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ceeac

I managed to reproduce this with the save file from this forum post using ASan with optimizations disabled. This does not happen when optimizations are enabled, so I guess this is an instance of "stack size not big enough" and switching to an iterative algorithm for leitung_t::verbinde should work.


=================================================================
==4250==ERROR: AddressSanitizer: stack-overflow on address 0x7ffef1137ea8 (pc 0x0000004a4e59 bp 0x7ffef11386f0 sp 0x7ffef1137eb0 T0)
    #0 0x4a4e59 in __asan_memcpy (/media/ceeac/Projects/code/simutrans/build/default/sim+0x4a4e59)
    #1 0x50f83a in koord::koord(unsigned char) /home/ceeac/Projects/code/simutrans/src/simutrans/builder/../gui/components/../../dataobj/koord.h:32:35
    #2 0x9ac7c6 in grund_t::get_neighbour(grund_t*&, waytype_t, unsigned char) const /home/ceeac/Projects/code/simutrans/src/simutrans/ground/grund.cc:1974:58
    #3 0x1421fba in leitung_t::gimme_neighbours(leitung_t**) /home/ceeac/Projects/code/simutrans/src/simutrans/obj/leitung2.cc:69:47
    #4 0x1425b06 in leitung_t::replace(powernet_t*) /home/ceeac/Projects/code/simutrans/src/simutrans/obj/leitung2.cc:194:5
    #5 0x1426086 in leitung_t::replace(powernet_t*) /home/ceeac/Projects/code/simutrans/src/simutrans/obj/leitung2.cc:197:14
    #6 0x1426086 in leitung_t::replace(powernet_t*) /home/ceeac/Projects/code/simutrans/src/simutrans/obj/leitung2.cc:197:14
    #7 0x1426086 in leitung_t::replace(powernet_t*) /home/ceeac/Projects/code/simutrans/src/simutrans/obj/leitung2.cc:197:14
<snip>
    #248 0x1426086 in leitung_t::replace(powernet_t*) /home/ceeac/Projects/code/simutrans/src/simutrans/obj/leitung2.cc:197:14

SUMMARY: AddressSanitizer: stack-overflow (/media/ceeac/Projects/code/simutrans/build/default/sim+0x4a4e59) in __asan_memcpy
==4250==ABORTING