Kaydet (Commit) 71f1553c authored tarafından Caolán McNamara's avatar Caolán McNamara

Related: coverity#1242658 Untrusted loop bound

Change-Id: Ic785b333c1ad31036da20483dc7310fcc5338d80
üst 885494f4
...@@ -990,7 +990,11 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo ...@@ -990,7 +990,11 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
if ( nRowBytes < 8 || nPackType == 1 ) if ( nRowBytes < 8 || nPackType == 1 )
{ {
const size_t nMaxPixels = pPict->remainingSize() / 4; const size_t nMaxPixels = pPict->remainingSize() / 4;
if (static_cast<size_t>(nHeight) * nWidth > nMaxPixels) const size_t nMaxRows = nMaxPixels / nWidth;
if (nHeight > nMaxRows)
BITMAPERROR;
const size_t nMaxCols = nMaxPixels / nHeight;
if (nWidth > nMaxCols)
BITMAPERROR; BITMAPERROR;
for ( ny = 0; ny < nHeight; ny++ ) for ( ny = 0; ny < nHeight; ny++ )
...@@ -1006,7 +1010,11 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo ...@@ -1006,7 +1010,11 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
else if ( nPackType == 2 ) else if ( nPackType == 2 )
{ {
const size_t nMaxPixels = pPict->remainingSize() / 3; const size_t nMaxPixels = pPict->remainingSize() / 3;
if (static_cast<size_t>(nHeight) * nWidth > nMaxPixels) const size_t nMaxRows = nMaxPixels / nWidth;
if (nHeight > nMaxRows)
BITMAPERROR;
const size_t nMaxCols = nMaxPixels / nHeight;
if (nWidth > nMaxCols)
BITMAPERROR; BITMAPERROR;
for ( ny = 0; ny < nHeight; ny++ ) for ( ny = 0; ny < nHeight; ny++ )
......
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