Opened 14 years ago

Closed 14 years ago

#3616 closed defect (invalid)

Integer overflow in Java bindings for huge image reading

Reported by: ehouzay Owned by: hobu
Priority: normal Milestone:
Component: SWIG (all bindings) Version: unspecified
Severity: major Keywords:


It's impossible to read huge images using Java binding (and quite sure other binding even if I don't test it). Integer overflow exception error comes in the console.

This error comes from SWIG and internal buffer size control.

Image size are computes as integer leading to integer overflow with big images.

Have a look in Dataset.i in swig/include...

int ComputeDatasetRasterIOSize (int buf_xsize, int buf_ysize, int nPixelSize,
                                int nBands, int* bandMap, int nBandMapArrayLength,
                                int nPixelSpace, int nLineSpace, int nBandSpace,
                                int bSpacingShouldBeMultipleOfPixelSize );

Change History (3)

comment:1 by Even Rouault, 14 years ago

Could you show the exact values of the parameters of the ReadRaster() call you make ? But I believe the error message is justified. You can't currently read more than 2 GB at once within GDAL and that's the purpose of these checks. This might work in some places, but for sure not all drivers are ready for this. So you can try removing the checks and it might work, but the best practice is that you should split your read into smaller and more manageable pieces.

comment:2 by ehouzay, 14 years ago

I have tested this on GeoTiff images of 12000x12000 in float (DEM) and Landsat RGB images in MrSID with images of 40000x40000 on a 64 bits computer with 16Gb of RAM...

In C/C++ all is OK. The problem comes from the bidding.

I use GDAL 1.7.2 recompiled from scratch.

As mentionned in the, this version support more than 2Gb allocation in the RasterIO function, called in the binding.

comment:3 by Even Rouault, 14 years ago

Resolution: invalid
Status: newclosed

I've checked. The Java language can't support more than 2 GB objects... There's nothing we can do about that unfortunately

Note: See TracTickets for help on using tickets.