Kaydet (Commit) 2934b737 authored tarafından Caolán McNamara's avatar Caolán McNamara

ofz#506 check len before alloc

Change-Id: Ia3a30936fadde10275a964d09150a3b6e4f3e16f
üst 55916dfc
...@@ -1080,13 +1080,13 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo ...@@ -1080,13 +1080,13 @@ sal_uLong PictReader::ReadPixMapEtc( Bitmap &rBitmap, bool bBaseAddr, bool bColo
sal_uInt8 nFlagCounterByte; sal_uInt8 nFlagCounterByte;
if ( ( nCmpCount == 3 ) || ( nCmpCount == 4 ) ) if ( ( nCmpCount == 3 ) || ( nCmpCount == 4 ) )
{ {
if ( ( pAcc = initBitmap(aBitmap, aPalette) ) == nullptr )
return 0xffffffff;
size_t nByteCountSize = nRowBytes > 250 ? sizeof(sal_uInt16) : sizeof(sal_uInt8); size_t nByteCountSize = nRowBytes > 250 ? sizeof(sal_uInt16) : sizeof(sal_uInt8);
if (nHeight > pPict->remainingSize() / nByteCountSize) if (nHeight > pPict->remainingSize() / nByteCountSize)
return 0xffffffff; return 0xffffffff;
if ( ( pAcc = initBitmap(aBitmap, aPalette) ) == nullptr )
return 0xffffffff;
std::unique_ptr<sal_uInt8[]> pScanline(new sal_uInt8[static_cast<size_t>(nWidth) * nCmpCount]); std::unique_ptr<sal_uInt8[]> pScanline(new sal_uInt8[static_cast<size_t>(nWidth) * nCmpCount]);
for (sal_uInt16 ny = 0; ny < nHeight; ++ny) for (sal_uInt16 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