[GRASS5] [bug #1052] (grass) [rsv].proj are crashing

this bug's URL: http://intevation.de/rt/webrt?serial_num=1052
-------------------------------------------------------------------------

Subject: [rsv].proj are crashing

grass binary for platform: Compiled from Sources

A critical bug report:

v.proj in=austria loca=europa mapset=europa
Segmentation fault (core dumped)

Also r.proj (and eventually s.proj, untested) are affected.

I have spent some time in src/libes/gis/env.c where the crash occurs
in line 195 of get_env() function. The reason is unclear to me why
strcmp() crashes sometimes (maybe someone else understands the
problem).

This should be fixed before pre5.

Markus

-------------------------------------------- Managed by Request Tracker

Request Tracker wrote:

Subject: [rsv].proj are crashing

grass binary for platform: Compiled from Sources

A critical bug report:

v.proj in=austria loca=europa mapset=europa
Segmentation fault (core dumped)

Also r.proj (and eventually s.proj, untested) are affected.

I have spent some time in src/libes/gis/env.c where the crash occurs
in line 195 of get_env() function. The reason is unclear to me why
strcmp() crashes sometimes (maybe someone else understands the
problem).

If strcmp() crashes, one of its arguments is invalid, in the sense
that either:

a) it points to an invalid address (e.g. NULL), or
b) it points to a valid address, but scanning the string reaches an
invalid address before it reads a terminating NUL byte.

So, something is passing bad values to strcmp(). In this instance,
either the "environment" is bad, or the caller is passing a bad "name"
argument to G_getenv() or similar.

--
Glynn Clements <glynn.clements@virgin.net>

On Wed, May 22, 2002 at 11:22:15AM +0200, Request Tracker wrote:

this bug's URL: http://intevation.de/rt/webrt?serial_num=1052
-------------------------------------------------------------------------

Subject: [rsv].proj are crashing

grass binary for platform: Compiled from Sources

A critical bug report:

v.proj in=austria loca=europa mapset=europa
Segmentation fault (core dumped)

Also r.proj (and eventually s.proj, untested) are affected.

I have spent some time in src/libes/gis/env.c where the crash occurs
in line 195 of get_env() function. The reason is unclear to me why
strcmp() crashes sometimes (maybe someone else understands the
problem).

This should be fixed before pre5.

r.proj at least does these dubious thing:

   strncpy (in_datum, G_database_datum_name(), sizeof(in_datum));
   strncpy (in_ellipse, G_database_ellipse_name(), sizeof(in_ellipse));

Since both the datum and ellipse functions can return NULL, strncpy
will invoke undefined behavior in those cases. For me, the segfault
in r.proj disappears, by handling these better.

Now, if I can figure out why "1" is returned as the projection name for
UTM...

--
Eric G. Miller <egm2@jps.net>

On Fri, 24 May 2002, Eric G. Miller wrote:

Now, if I can figure out why "1" is returned as the projection name for
UTM...

Sounds like some artifact from old times is playing in here. UTM was one
of the few possible projection types in grass before proj was integrated
and the type 99 'other' was added. But even if proj can handle UTM, you
still find 'wrappers' here and there in the code that will give UTM
projection special treatment, i.e not passing it to proj at all, but
using the old code. Maybe the "1" is a response from some old stuff.

Morten Hulden