[GRASS5] [bug #4352] (grass) v.to.db: segfault on layer > 1

Request Tracker grass-bugs at intevation.de
Thu Apr 27 05:23:32 EDT 2006


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

Subject: v.to.db: segfault on layer > 1

v.db.addtable map_name layer=2  # or > 2

causes a segault in v.to.db:

+ v.db.connect map=tmp_a
database=/home/hamish/grassdata/spearfish60/user1/dbf/ driver=dbf layer=3
table=tmp_a_3 key=cat
WARNING: The table <tmp_a_3> is now part of vector map <tmp_a> and may be
         deleted or overwritten by GRASS modules.
WARNING: Select privileges were granted on the table.
+ v.to.db tmp_a layer=3 option=cat col=cat
ERROR: G_calloc: out of memory


to recreate input map see:  (swath_area vector)
  http://grass.itc.it/pipermail/grassuser/2006-April/033921.html

[boundaries of that vector have a cat of -1
 (it has centroid+area of cat 1 as well)
 nope, using 'v.category op=del type=boundary' doesn't help]



running in kdbg...
If fails on this line (55):
    Values = (VALUE *) G_calloc ( n + 1, sizeof ( VALUE ) );

because n is being used uninitialized. (n=1071328722)


    n = Vect_cidx_get_num_unique_cats_by_index ( &Map,
Vect_cidx_get_field_index(&Map, options.field ) );


as Vect_cidx_get_field_index() fails to find the layer and returns -1
instead of a valid layer number.

and Vect_cidx_get_num_unique_cats_by_index() checks that the layer index
isn't >= the number of layers, but not that it could be set to -1.


so Vect_cidx_get_num_unique_cats_by_index() could use another error test,
but that still won't fix why it can't find the layer. 


Hamish


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




More information about the grass-dev mailing list