Kaydet (Commit) 8eaef6b5 authored tarafından Caolán McNamara's avatar Caolán McNamara

fail on short read

Change-Id: I7215cf8d8b1e4a4156c87507018de3c2b7ed08d8
üst 68fed354
...@@ -656,7 +656,7 @@ bool TIFFReader::ReadMap() ...@@ -656,7 +656,7 @@ bool TIFFReader::ReadMap()
} }
else if ( nCompression == 32773 ) else if ( nCompression == 32773 )
{ {
sal_uLong nStrip,nRecCount,nRowBytesLeft,np,i; sal_uLong nStrip,nRecCount,np,i;
sal_uInt8 * pdst; sal_uInt8 * pdst;
nStrip = 0; nStrip = 0;
if ( nStrip >= nNumStripOffsets ) if ( nStrip >= nNumStripOffsets )
...@@ -673,7 +673,7 @@ bool TIFFReader::ReadMap() ...@@ -673,7 +673,7 @@ bool TIFFReader::ReadMap()
return false; return false;
pTIFF->Seek(pStripOffsets[nStrip]); pTIFF->Seek(pStripOffsets[nStrip]);
} }
nRowBytesLeft = nBytesPerRow; sal_uLong nRowBytesLeft = nBytesPerRow;
if (np >= SAL_N_ELEMENTS(pMap)) if (np >= SAL_N_ELEMENTS(pMap))
return false; return false;
pdst=pMap[ np ]; pdst=pMap[ np ];
...@@ -687,6 +687,8 @@ bool TIFFReader::ReadMap() ...@@ -687,6 +687,8 @@ bool TIFFReader::ReadMap()
if ( nRecCount > nRowBytesLeft ) if ( nRecCount > nRowBytesLeft )
return false; return false;
pTIFF->Read(pdst,nRecCount); pTIFF->Read(pdst,nRecCount);
if (!pTIFF->good())
return false;
pdst+=nRecCount; pdst+=nRecCount;
nRowBytesLeft-=nRecCount; nRowBytesLeft-=nRecCount;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment