[GRASS-dev] Re: [GRASS GIS] #461: v.to.db crashes on a shapefile connected with v.external

GRASS GIS trac at osgeo.org
Tue Jan 12 03:35:50 EST 2010


#461: v.to.db crashes on a shapefile connected with v.external
-----------------------+----------------------------------------------------
  Reporter:  msieczka  |       Owner:  grass-dev at lists.osgeo.org
      Type:  defect    |      Status:  new                      
  Priority:  critical  |   Milestone:  6.4.0                    
 Component:  Vector    |     Version:  svn-develbranch6         
Resolution:            |    Keywords:                           
  Platform:  Linux     |         Cpu:  x86-64                   
-----------------------+----------------------------------------------------
Comment (by mmetz):

 Replying to [comment:6 glynn]:
 > Replying to [comment:5 hamish]:
 > > We may not be able to add the requested functionality for the next
 release, but can we do anything about replacing the segfault with a
 G_fatal_error()?
 >
 > The following is based upon the backtrace, and is completely untested:
 >
 {{{
  --- lib/db/dbmi_client/select.c        (revision 40258)
  +++ lib/db/dbmi_client/select.c        (working copy)
  @@ -134,6 +134,8 @@

       table = db_get_cursor_table(&cursor);
       column = db_get_table_column(table, 0);   /* first column */
  +    if (!column)
  +      G_fatal_error(_("Table has no columns"));
       value = db_get_column_value(column);
       type = db_get_column_sqltype(column);
      type = db_sqltype_to_Ctype(type);
 }}}

 Going a bit further to the root of the problem: in this case const char
 *col passed to db_select_int() in lib/db/dbmi_client/select.c is a zero
 length string, you could do for 'col' the same test that's done for
 'where' and exit with an error.

 Even further down, the question is, what to do if OGR_L_GetFIDColumn()
 doesn't return FID name, to cite a comment from Vect_read_dblinks().

 Markus M

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/461#comment:8>
GRASS GIS <http://grass.osgeo.org>


More information about the grass-dev mailing list