[GRASS-dev] [GRASS GIS] #1914: Possible infinite loop in v.in.dxf (present in 6.4.3RC2)

GRASS GIS trac at osgeo.org
Thu Apr 4 01:43:20 PDT 2013


#1914: Possible infinite loop in v.in.dxf (present in 6.4.3RC2)
--------------------------------+-------------------------------------------
 Reporter:  RikSaunderson       |       Owner:  grass-dev@…              
     Type:  defect              |      Status:  new                      
 Priority:  minor               |   Milestone:  6.4.3                    
Component:  Vector              |     Version:  6.4.3 RCs                
 Keywords:  DXF, infiinte loop  |    Platform:  All                      
      Cpu:  Unspecified         |  
--------------------------------+-------------------------------------------
 Hi there,

 In the file dxf_to_vect.c, which is part of v.in.dxf, there is a potential
 infinite loop.  The code is as follows (lines 23-29, in function int
 dxf_to_vect(struct dxf_file *dxf, struct Map_info *Map)):

 while (code != 0)
 {
     if (code == -2)     /* EOF */
         return -1;

     /* only looking for header groups (code == 9) */

     if (code != 9)
         continue;
     ...

     //value of code is modified down here
 }

 This snippet is looking for the Id of a header section of a DXF file.
 An Id of 9 denotes the header of the file, other Ids represent other
 things.

 If a corrupted DXF file is input, or a completely different type of file
 which is not a DXF file but superficially looks like one, then this could
 result in an infinite loop.  If the value of code is, for example, 5 the
 first time we enter this loop, then the loop will never terminate.

-- 
Ticket URL: <http://trac.osgeo.org/grass/ticket/1914>
GRASS GIS <http://grass.osgeo.org>



More information about the grass-dev mailing list