Opened 8 years ago
Last modified 8 years ago
#6448 closed defect
gdalwarp failed — at Initial Version
Reported by: | liminlu0314 | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.11.5 |
Component: | Algorithms | Version: | |
Severity: | normal | Keywords: | gdalwarp, int overflow |
Cc: |
Description
When the value of GDALWarpOptions::dfWarpMemoryLimit is set to be very large, such as 10 GB, the program will fail, because the size of allocated memory overflows. The original is as below:
gdalwarpoperation.cpp line 2059
if( *ppMask == NULL ) { int nBytes; //this line should be GIntBig nBytes; if( nBitsPerPixel == 32 ) nBytes = (nXSize * nYSize + nExtraElts) * 4; else nBytes = (nXSize * nYSize + nExtraElts + 31) / 8; *ppMask = VSI_MALLOC_VERBOSE( nBytes ); if( *ppMask == NULL ) { return CE_Failure; } memset( *ppMask, nDefault, nBytes ); }
The modified code is as follows:
if( *ppMask == NULL ) { GIntBig nBytes; if( nBitsPerPixel == 32 ) nBytes = ((GIntBig )nXSize * nYSize + nExtraElts) * 4; else nBytes = ((GIntBig )nXSize * nYSize + nExtraElts + 31) / 8; *ppMask = VSI_MALLOC_VERBOSE( nBytes ); if( *ppMask == NULL ) { return CE_Failure; } memset( *ppMask, nDefault, nBytes ); }
Note:
See TracTickets
for help on using tickets.