-
-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] r.stats.quantile produces segfault #2259
Comments
... maybe caused by c700a8a? Just noticed that with GRASS 8.0.0 it works fine. |
quants = G_calloc(num_quants, sizeof(DCELL)); grass/raster/r.stats.quantile/main.c Lines 90 to 95 in fdff46c
I believe the fix for this is to change line 90 to: if (n > num_quants) { |
Sorry, that can't be right. |
crash log:
|
Some debug info:
|
I can confirm this bug for GRASS GIS 8.1.dev (9c4ded9) on Ubuntu 20.04 |
@wenzeslaus is this a difficult one to fix? Waiting till 8.2.0 means this function won't be available for a while. Don't want to push, just to know whether I and my students are better off reverting to an older version of grass for the time being. |
I tracked the immediate cause of the segfault. In grass/raster/r.stats.quantile/main.c Line 170 in b95f3ee
allocates zero objects for and grass/raster/r.stats.quantile/main.c Lines 218 to 223 in b95f3ee
This is faulted in grass/raster/r.stats.quantile/main.c Lines 424 to 433 in b95f3ee
I don't know for sure what would be the correct fix for this, maybe @metzm have? |
@ecodiv I marked this as 8.2.0 because I though c700a8a (#2108 fix quantile algorithm) is only in the main branch and from the comments it seemed it is the likely cause and 8.0.0 is fine. However, now I see it was backported to the 8.0 branch in 44949fa. As for the timelines, the planned release dates for 8.2.0 and 8.0.2 are actually similar (see https://github.com/OSGeo/grass/milestones). Notably, r.stats.quantile doesn't have any tests, so it is not checked by the automated checks in CI. (same for and r.quantile but that one was tested manually according to #2108; r.neighbors has tests) |
Thanks for the feedback @wenzeslaus. I wish I knew how to write such tests. On a different note, not sure it is useful, but tested it on different versions in Windows. Version 8.01 on Windows, installed using OSGeo4W runs without error (also when running with debug level 5), but also without showing the results.
Version 8.1.dev on Windows (code revision d21dd0a), installed using standalone installer runs (somewhat unexpectedly given the above) fine.
|
I think I found the change in #2108 that causes this segfault, it could be fixed with a single line. A corresponding PR should come today or tomorrow. |
* sync correctly to r.quantile * fix segfault Fixes #2259
* sync correctly to r.quantile * fix segfault Fixes #2259
* r.stats.quantile: minimalistic testsuite added, triggers #2259 Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
* r.stats.quantile: minimalistic testsuite added, triggers #2259 Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
* sync correctly to r.quantile * fix segfault Fixes OSGeo#2259
* r.stats.quantile: minimalistic testsuite added, triggers OSGeo#2259 Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
* sync correctly to r.quantile * fix segfault Fixes OSGeo#2259
* r.stats.quantile: minimalistic testsuite added, triggers OSGeo#2259 Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
* sync correctly to r.quantile * fix segfault Fixes OSGeo#2259
* r.stats.quantile: minimalistic testsuite added, triggers OSGeo#2259 Co-authored-by: Anna Petrasova <kratochanna@gmail.com>
Describe the bug
r.stats.quantile
terminates with a segfault during quantile calculation.To Reproduce
Using North Carolina sample dataset:
r.stats.quantile base=zipcodes cover=elevation quantiles=3 -p
Screenshots
Valgrind gives:
System description (please complete the following information):
The text was updated successfully, but these errors were encountered: