The International Simutrans Forum

 

Author Topic: [r8688] station extension building: choosing another orientation than south SEGV  (Read 356 times)

0 Members and 1 Guest are viewing this topic.

Offline captain crunch

  • *
  • Posts: 114
When building an station extension building choosing another orientation than south results in Segmentation Fault.
I would expect to be able to choose another orientation than the default, like it worked before now.

To reproduce the error:
- start simutrans and load plain pak64
- click on rail building tools
- hold control key and click on a extension building to open the orientation choice dialog
- click on another orientation than the upper left

gdb backtrace:
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000056078366c5f2 in tool_build_station_t::check_pos(player_t*, koord3d)
    ()
[Current thread is 1 (Thread 0x7f64ea58d740 (LWP 13672))]
(gdb) bt
#0  0x000056078366c5f2 in tool_build_station_t::check_pos(player_t*, koord3d)
    ()
#1  0x000056078364026f in interaction_t::move_cursor(event_t const&) ()
#2  0x0000560783641456 in interaction_t::check_events() ()
#3  0x00005607836b0fa7 in karte_t::interactive(unsigned int) ()
#4  0x000056078364b903 in simu_main(int, char**) ()
#5  0x0000560783663219 in sysmain(int, char**) ()
#6  0x00007f64e8e242e1 in __libc_start_main (main=0x56078335c960 <main>,
    argc=1, argv=0x7ffe8cbe35a8, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7ffe8cbe3598)
    at ../csu/libc-start.c:291
#7  0x000056078335c99a in _start ()

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2709
  • Languages: EN
Should be fixed with R8689.

During the recent UI revision the way tool parameters were generated changed from an overflow prone static character array of fixed length to a static character buffer of dynamic length. Where as print methods for the character array start from the beginning of the array and replaces previous content, the print method for the character buffer appends to the end of the string and does not replace previous content. This resulted in the creation of a malformed tool parameter which caused a crash when the tool was used. The solution is to clear the static character buffer, discarding the previous content, before printing the tool parameter to it.

I did not even know Simutrans had this feature until this report. I wonder how many other hidden features I do not know about...

Offline captain crunch

  • *
  • Posts: 114
Yes, you fixed it! Thanks alot!