[GRASS-dev] [GRASS GIS] #3249: v.what.rast: segfault with map without topology

GRASS GIS trac at osgeo.org
Wed Jan 11 23:59:01 PST 2017

#3249: v.what.rast: segfault with map without topology
  Reporter:  sbl          |      Owner:  martinl
      Type:  defect       |     Status:  assigned
  Priority:  normal       |  Milestone:  7.4.0
 Component:  Vector       |    Version:  svn-trunk
Resolution:               |   Keywords:  v.what.rast, level 1
       CPU:  Unspecified  |   Platform:  Unspecified

Comment (by marisn):

 When ever there seems to be a problem with memory, use valgrind!

 The reason of segfault is a failure to allocate memory on line 197. It
 comes from call to Vect_get_num_primitives few lines earlier.
 Vect_get_num_primitives uses Map.plus to get info about number of
 features, but plus "Holds basic topology-related information about vector
 map". No topology == no number of features in plus == allocation of 0
 sized memory for cache == illegal writes further in code.

 * information about number of features must be obtained in some other way
 * probably also Vect_get_num_primitives should be modified to return -1 if
 topology is missing

Ticket URL: <https://trac.osgeo.org/grass/ticket/3249#comment:9>
GRASS GIS <https://grass.osgeo.org>

More information about the grass-dev mailing list