[postgis-tickets] [PostGIS] #2772: Memory corruption in ST_BandPath

PostGIS trac at osgeo.org
Fri Jun 20 09:05:58 PDT 2014


#2772: Memory corruption in ST_BandPath
--------------------+-------------------------------------------------------
 Reporter:  strk    |       Owner:  dustymugs    
     Type:  defect  |      Status:  assigned     
 Priority:  high    |   Milestone:  PostGIS 2.0.7
Component:  raster  |     Version:  2.0.x        
 Keywords:          |  
--------------------+-------------------------------------------------------

Comment(by strk):

 My patch for 2.0 is this one:
 {{{
 diff --git a/raster/rt_pg/rt_pg.c b/raster/rt_pg/rt_pg.c
 index 2ced796..e020e0b 100644
 --- a/raster/rt_pg/rt_pg.c
 +++ b/raster/rt_pg/rt_pg.c
 @@ -2385,10 +2385,10 @@ Datum RASTER_getBandPath(PG_FUNCTION_ARGS)
      }

      bandpath = rt_band_get_ext_path(band);
 -               rt_band_destroy(band);
 -    rt_raster_destroy(raster);
      if ( ! bandpath )
      {
 +        rt_band_destroy(band);
 +        rt_raster_destroy(raster);
          PG_RETURN_NULL();
      }

 @@ -2398,6 +2398,9 @@ Datum RASTER_getBandPath(PG_FUNCTION_ARGS)

      strcpy((char *) VARDATA(result), bandpath);

 +    rt_band_destroy(band);
 +    rt_raster_destroy(raster);
 +
      PG_RETURN_TEXT_P(result);
  }
 }}}

 For the memory corruption I filed #2773

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2772#comment:5>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list