Opened 11 years ago
Last modified 11 years ago
#5268 closed defect
RMF DEM (*.mtw) decompression bug — at Initial Version
Reported by: | yupsi | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.10.2 |
Component: | GDAL_Raster | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
/trunk/gdal/frmts/rmf/rmfdem.cpp contains a decompression algorythm for RMF DEM data. Here is a part of the file that deals with 3-byte integer records:
238 case TYPE_INT24: 239 if ( nSizeIn < 3 * nCount ) 240 break; 241 if ( nSizeOut < nCount ) 242 break; 243 nSizeIn -= 3 * nCount; 244 nSizeOut -= nCount; 245 246 while ( nCount-- > 0 ) 247 { 248 nCode =*((GInt32 *)pabyTempIn) & 0x0FFF; 249 pabyTempIn += 3; 250 if ( nCode > RANGE_INT24 ) 251 nCode |= INV_INT24; 252 *paiOut++ = ( nCode == OUT_INT24 ) ? 253 OUT_INT32 : iPrev += nCode; 254 } 255 break;
I experienced receiving inconsistent data from this function, and then fixed it by replacing 0x0FFF with 0x00FFFFFF at line 248. It makes sense. 0x0FFF might have been copypasted from TYPE_INT12 case and then neglected. Original code author (dron) hasn't responded to my e-mail, so I'm just leaving this here.
Note:
See TracTickets
for help on using tickets.