[gdal-dev] Bug in GDALGetRasterSampleOverview

Mateusz Łoskot mateusz at loskot.net
Sat Dec 17 09:30:09 EST 2011


On 17 December 2011 11:57, Even Rouault <even.rouault at mines-paris.org> wrote:
> Le samedi 17 décembre 2011 13:38:16, Marian Krivos a écrit :
>> Hello,
>>
>> current implementation of GDALGetRasterSampleOverview() don't work
>> properly for big rasters
>> over 2GB because of integer overflow.
>>
>> Solutions is replace int for unsigned long at the price of API/ABI broke.
>
> Something you might want to add in
> http://trac.osgeo.org/gdal/wiki/GDAL20Changes
>
> Actually, GIntBig which is guaranteed to be 64bits even on 32bit platform
> would be better.

Even,

If you consider changing int to GIntBig in GDAL 2.0, perhaps you could
consider  to change it to more appropriate types for any raster-space
calculations. Neither int, nor GIntBig is a correct memsize-type [1]
It is not about size of memsize-type, but also about type.
It is not about size, but about size and type.
I can't see benefits of reinventing memsize-types and using custom types
when C and C++ has been equipped with memsize types for long time now.

Please, consider switching to correct memsize-types
once and for good: ptrdiff_t and size_t.
I'm willing to help in implementing such switch.

[1] http://www.viva64.com/en/l/0013/

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the gdal-dev mailing list