[GRASS-user] Segmentation fault with i.atcorr
Markus Neteler
neteler at osgeo.org
Tue Jun 3 16:29:13 EDT 2008
On Tue, Jun 3, 2008 at 10:00 PM, Glynn Clements
<glynn at gclements.plus.com> wrote:
...
> 2. that's line 304 (of main.cpp):
>
> if(isnan(vis[col]) || isnan(alt[col]) || isnan(buf[col])) {buf[col] = FP_NAN; continue;}
>
> Contrary to what the author probably assumed, FP_NAN isn't NaN. It's
> the value which the fpclassify() function returns if its argument is
> NaN.
>
> C99 defines the macro NAN in <math.h>; I don't know about C++.
>
> AFAIK, the most portable way to create a NaN value is "0.0/0". In
> GRASS, you can use e.g. G_set_f_null_value().
I have added a related TODO comment.
> In any case, the problem appears to be that the code is accessing
> elements of vis and alt without checking that those arrays have been
> allocated.
>
> - if(isnan(vis[col]) || isnan(alt[col]) || isnan(buf[col])) {buf[col] = FP_NAN; continue;}
> + if(vis && isnan(vis[col]) || alt && isnan(alt[col]) || isnan(buf[col])) {buf[col] = FP_NAN; continue;}
I have submitted that as it now no longer crashes. But it's (for me)
either extremely
slow (remaining at 0%) or endless looping.
Maning, does it now work for you (hope you can update from SVN)?
Markus
More information about the grass-user
mailing list