[gdal-dev] gdalwarp integer overflow

Vincent Schut schut at sarvision.nl
Wed Dec 4 00:20:10 PST 2013


On 12/03/2013 04:56 PM, Even Rouault wrote:
> Hi,
>
> do you have many bands and what is their data type ? Because the check for
> integer overflows does nSrcXSize * nSrcYSize * nWordSize *  nBandCount.
> nSrcXSize * nSrcYSize by itself is 214 659 158. So it means that you have more
> than 10 bands of Byte type, or other combinations of band number/data type that
> cause the number to go over 2 billion.
>
> I think the cause of the issue is the large over sampling you are attempting.
> This requires to fetch an anourmous source area for a tinish target area. I
> suggest you do gdalwarp in several times by using decreasing sizes. Perhaps just
> an intermediate state will be necessary.
>
> In the situation, the warping algorithm could also be smarter and realize that
> in nearest neighbour resampling it doesn't need to fetch a source area but just
> fetch individual source pixels. But that's a pretty unusual case (usually the
> number of source pixels more or less matches the number of target pixels)
>
> Even

Even, thank you for this clear explanation. I'll try the 2-steps workaround.

Vincent.

>
>> Hi,
>>
>> I get the following error (integer overflow) when running gdalwarp on a
>> very large vrt to reproject to a very small tif:
>>
>> gdalwarp -overwrite -t_srs epsg:4326 -te -180 -90 180 90 -ts 36 18 -r
>> near ${YEAR}/world_${YEAR}_sinu.vrt ${YEAR}/world_${YEAR}_ll_overview.tif
>> Creating output file that is 36P x 18L.
>> Processing input file 2013/world_2013_sinu.vrt.
>> Using internal nodata values (e.g. 0) for image 2013/world_2013_sinu.vrt.
>> Copying nodata values from source 2013/world_2013_sinu.vrt to
>> destination 2013/world_2013_ll_overview.tif.
>> 0...10...20...30...40...50...60ERROR 1: Integer overflow :
>> nSrcXSize=22358, nSrcYSize=9601
>>
>> I also tried -r average, which gives the same error.
>> Note that this might be a less than average usecase: I am running
>> gdalwarp on a vrt (built with gdalbuildvrt) of dimensions 172800, 33600
>> and sinusoidal projection, to create a tif with dimensions of 36, 18 (10
>> deg/pixel) and latlon wgs84 projection. This because ultimately I want
>> to create latlon tiles of 10x10 degrees, but want to avoid creating
>> empty tiles, so I'll use gdallocationinfo on the 36x18 tif to check if
>> this 10x10 degree square actually has data.
>>
>> Any insights or tips on what could be wrong or how to debug/prevent this
>> are welcome (e.g. should I try some specific warpoptions?)
>>
>> Thanks in advance,
>> Vincent.
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>
>
>


More information about the gdal-dev mailing list