[GRASS5] Segfault in v.in.tig.lndmk

Tom Rake duff_maps at hotmail.com
Thu Feb 14 14:47:41 EST 2002

Grass Developers,

I found a Segfault in v.in.tig.lndmk. Here is a summary of my fault case and 
a patch that fixed this for me.

My distro and grass source

Debian/GNU Linux; grass CVS HEAD; (I believe the release branch should also 
have same fault - have not tested this ).

Data used for fault case:


Setup this location:

location: sullivan
mapset: census
UTM zone 18


Make this file *fault.txt*

.points hospitality

***** End of fault.txt

Run this grass command

v.in.tig.lndmk t1=/dir/to/unziped/TGR36105.RT1 input=crash.txt

My Analysis

the Site_head info struct in open_site_file() from points.c failed to fully 
initialize the structure. The info.stime if non null garbage is taken by 
G_site_put_head() to me a valid structure.

This Patch fully initializes the structure to NULLs.

RCS file: 
retrieving revision 1.2
diff -c -r1.2 points.c
*** points.c	12 Jan 2001 08:16:28 -0000	1.2
--- points.c	14 Feb 2002 19:20:25 -0000
*** 42,47 ****
--- 42,53 ----
    FILE *fp1;
    Site_head info;

+   info.name = NULL;
+   info.desc = NULL;
+   info.form = NULL;
+   info.labels = NULL;
+   info.stime = NULL;
+   info.time = NULL;
    if (sitefile == NULL)
      if ((sitefile = G_fopen_sites_new (site_name)) == NULL)

-Tom Rake

Send and receive Hotmail on your mobile device: http://mobile.msn.com

More information about the grass-dev mailing list