[gdal-dev] Incorrect image bytes from VSIGetMemFileBuffer in GDAL < 2.1.0

Even Rouault even.rouault at spatialys.com
Tue Sep 27 05:59:12 PDT 2016


Le mardi 27 septembre 2016 14:09:30, Sean Gillies a écrit :
> Hi all,
> 
> I've got code in Rasterio that calls VSIGetMemFileBuffer to get PNG or JPEG
> image bytes. With GDAL 1.11, I found that I had to fix the resulting byte
> array by moving the last byte to the head of the array. With GDAL 2.1.0 and
> 2.1.1 this is no longer needed and we can return an unshifted array (see
> the changeset below).
> 
> https://github.com/mapbox/rio-mbtiles/compare/master...brendan-ward:bad_byt
> es?expand=1#diff-cfcb7125bae0f25564785b33fa38d6a1L45
> 
> I haven't been able to find the change in the change log or tracker. Can
> anyone point me to the commit that changed this so I can pin down the
> versions when it changed?

Sean,

This is super weird and I'm pretty sure nothing has changed in that area. 
VSIGetMemFileBuffer() has been used for long by a number of drivers in GDAL and 
none of them has ever had to do such weird things, so I'm quite skeptical 
there's a bug in that area, or it is something more subtle. Did you check that 
the issue is in GDAL itself, by breaking with the debugger or adding debug 
traces in VSIGetMemFileBuffer to check the buffer values ?

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list