[GRASS-dev] Re: [GRASS GIS] #727: Rast_get_d_color() segfault in trunk

GRASS GIS trac at osgeo.org
Fri Aug 21 04:43:42 EDT 2009


#727: Rast_get_d_color() segfault in trunk
---------------------+------------------------------------------------------
  Reporter:  hamish  |       Owner:  grass-dev at lists.osgeo.org   
      Type:  defect  |      Status:  new                         
  Priority:  normal  |   Milestone:  6.4.0                       
 Component:  Raster  |     Version:  svn-trunk                   
Resolution:          |    Keywords:  r.what, Rast_is_null_value()
  Platform:  Linux   |         Cpu:  x86-64                      
---------------------+------------------------------------------------------
Comment (by glynn):

 Replying to [ticket:727 hamish]:

 > I'm getting a segfault in grass7's r.what if I give it an out-of-region
 coordinate.

 >
 {{{
 Program received signal SIGSEGV, Segmentation fault.
 ...
 (gdb) bt
 ...
 #7  0x0000000000402783 in main (argc=5, argv=0x7fff847d8c98) at main.c:384
 }}}

 The code in question is:

 {{{
 383                 if (out_type[i] == CELL_TYPE)
 384                     Rast_get_c_color(&cell[i][cache[point].col],
 385                                          &red, &green, &blue,
 &ncolor[i]);
 386                 else
 387                     Rast_get_d_color(&dcell[i][cache[point].col],
 388                                          &red, &green, &blue,
 &ncolor[i]);
 }}}

 {{{
 > print cache[point].col
 $3 = -19297
 }}}

 The above code needs to check that the indices are within the array's
 bounds.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/727#comment:4>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list