[gdal-dev] Seg fault & error running gdal_rasterize on a non georeferenced raster

Ari Jolma ari.jolma at gmail.com
Wed Nov 30 08:43:24 PST 2016


At gdalrasterize.cpp:349 there is a call to Transformer but the 
TransformArg is NULL, which leads to segfault. Above the call there is a 
comment:

// TODO: We need to add all appropriate error checking at some point.

Obviously not all error checking is not done.

I also noticed that in Perl code there is some additional ease of use 
added to the user - she can give to the Rasterize method simply a file 
name, which implicitly assumes that the user has given options that 
cause the file to be created, and if not the result is a segfault. The 
same happens in gdal_rasterize:

gdal_rasterize -burn 17 -l features 20.gml test.tiff

results in segfault

Ari

30.11.2016, 16:51, Kurt Schwehr kirjoitti:
> Bugger.  That segfault should be turned into a clean failure.  I 
> looked a bunch and wasn't sure how to safely do that.
>
> This didn't do the job...  the segfault happens somewhere after this.
>
> svn diff gdalrasterize.cpp
> Index: gdalrasterize.cpp
> ===================================================================
> --- gdalrasterize.cpp(revision 36569)
> +++ gdalrasterize.cpp(working copy)
> @@ -635,6 +635,10 @@
>          pfnTransformer = GDALGenImgProjTransform;
>      }
> +    if( pfnTransformer == NULL )
> +    {
> +        return CE_Failure;
> +    }
>  /* 
> -------------------------------------------------------------------- */
>  /*      Establish a chunksize to operate on.  The larger the chunk   
>    */
>  /*      size the less times we need to make a pass through all the   
>    */
>
>
> On Wed, Nov 30, 2016 at 5:03 AM, Tim Waters <chippy2005 at gmail.com 
> <mailto:chippy2005 at gmail.com>> wrote:
>
>     On 29 November 2016 at 22:36, Even Rouault
>     <even.rouault at spatialys.com <mailto:even.rouault at spatialys.com>>
>     wrote:
>     > Tim,
>     >
>     > Could you provide the dataset to reproduce as well ? And it
>     seems your
>     > Python script is not valid since the 'sr' variable passed in
>     > rast_ogr_ds.CreateLayer( 'poly', srs=sr ) is not defined.
>
>     Hello,
>
>     Apologies for the script not working! I sanitized paths etc and broke
>     it, doh - I hope this email helps.
>
>     I've put all the correct files in a new GitHub repository:
>     https://github.com/timwaters/gdal_rasterize_error
>     <https://github.com/timwaters/gdal_rasterize_error>
>     including an expected screenshot of the inverted burn which was
>     generated from my box running 1.10.1
>
>     (Note that it appears that in 1.10.1 the raster does successfully get
>     burnt, no error or segfault is shown, but the script will output
>     "fail")
>
>     I've looked at whether -to SRC_METHOD=NO_GEOTRANSFORM is available for
>     the gdal_rasterize utility but I don't think it is?
>
>     Best regards and thanks in advance,
>
>     Tim
>     _______________________________________________
>     gdal-dev mailing list
>     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/gdal-dev
>     <http://lists.osgeo.org/mailman/listinfo/gdal-dev>
>
>
>
>
> -- 
> -- 
> http://schwehr.org
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20161130/36f8da70/attachment-0001.html>


More information about the gdal-dev mailing list