The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: Phystam on April 17, 2022, 04:31:29 PM

Title: [Segfault] create a new map with trees and forests
Post by: Phystam on April 17, 2022, 04:31:29 PM
Creation of a new map with trees and forests seems to be broken currently.
A backtrace shows that it is caused by tree_builder_t::fill_trees().
(https://media.discordapp.net/attachments/737992275220627456/965127072496377936/unknown.png)
Title: Re: [Segfault] create a new map with trees and forests
Post by: jamespetts on April 18, 2022, 10:27:25 AM
Thank you for your report. Can I check whether this always occurs with any given map generation involving any trees, or only occasionally?
Title: Re: [Segfault] create a new map with trees and forests
Post by: Ranran on April 18, 2022, 10:58:11 AM
Although those codes were brought from the standard by ceeac a few months ago, the standard and the code look almost the same.
Since there are many commits in extended that have not yet been incorporated, such as climate patches and tree offset, there may be many inconsistencies that are not visualized.
I'm not familiar with those specs so I don't know how tied tree planting to climate patches.

However, as far as I tested with small map generation, map generation with tree planting was possible.
Title: Re: [Segfault] create a new map with trees and forests
Post by: Phystam on April 19, 2022, 11:55:32 AM
I tried to create a new map with this .ppm file:
https://cdn.discordapp.com/attachments/965943187946475541/965943292107849758/philip125.zip
Please make sure that this file can reproduce the segfault.
settings:
 load option: legacy(small height)
 sea level=-11
Title: Re: [Segfault] create a new map with trees and forests
Post by: DrSuperGood on April 20, 2022, 02:39:01 AM
As a rough guess it looks like the function does not do sanity checks on arguments for if the provided map area to fill exists. As such I would recommend checking the arguments it is being passed if they make sense and are not off by 1.
Title: Re: [Segfault] create a new map with trees and forests
Post by: jamespetts on April 20, 2022, 05:18:20 PM
Thank you for the report, and especially to Phystam for the reliable reproduction case. I believe that I have now fixed this - I should be grateful if you could test with to-morrow's nightly build.
Title: Re: [Segfault] create a new map with trees and forests
Post by: Phystam on April 22, 2022, 06:14:39 AM
Thank you, I have confirmed that the problem is fixed.