[GRASS-dev] [GRASS GIS] #3062: Segmentation fault with r.buffer

GRASS GIS trac at osgeo.org
Wed Jun 15 14:44:50 PDT 2016

#3062: Segmentation fault with r.buffer
  Reporter:  escheper  |      Owner:  grass-dev@…
      Type:  defect    |     Status:  new
  Priority:  blocker   |  Milestone:  7.0.5
 Component:  Raster    |    Version:  7.0.4
Resolution:            |   Keywords:  r.buffer
       CPU:  Other     |   Platform:  Linux

Comment (by escheper):

 Thanks for your support!

 Reading the map didn't cause the problem. The method read_input_map()
 finishes without a fault.
 The segmentation fault occurs in execute_distance() in execute.c after the
 message "Finding buffer zones..." is shown.

 After adding "G_free(map);" in read_input_map() the r.buffer command
 crashes within that method and execute_distances() isn't executed. So I
 removed the "G_free(map)" again.

 After adding some debug statements I have noticed the program crashes at
 the following point in process_left().

         /* convert 1,2,3,4 to -1,0,1,2 etc. 0 becomes ndist */

         G_message(_("cur_zone: %i ZONE_INCR: %i ndist: %i to_ptr:
         if ((cur_zone = *--to_ptr))
             cur_zone -= ZONE_INCR;
             cur_zone = ndist;

 The last lines of the debug output was:


 cur_zone: 16538 ZONE_INCR: 2 ndist: 1 to_ptr: -2116621104

 Segmentation fault

 I do not have much experience with C so maybe you can give me a clue.

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

More information about the grass-dev mailing list