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

ofz#882: test available len against max possible compression

Change-Id: I19867b74d860f379eae17916cc7f6415e6d20074
üst 5885a5da
......@@ -596,6 +596,16 @@ bool PNGReaderImpl::ImplReadHeader( const Size& rPreviewSizeHint )
if ( nScansize64 > SAL_MAX_UINT32 )
return false;
// assume max theoretical compression of 1:1032
sal_uInt64 nMinSizeRequired = (nScansize64 * maOrigSize.Height()) / 1032;
if (nMinSizeRequired > mnStreamSize)
{
SAL_WARN("vcl.gdi", "overlarge png dimensions: " <<
maOrigSize.Width() << " x " << maOrigSize.Height() << " depth: " << (int)mnPngDepth <<
" couldn't be supplied by file length " << mnStreamSize << " at least " << nMinSizeRequired << " needed ");
return false;
}
mnScansize = static_cast< sal_uInt32 >( nScansize64 );
// calculate target size from original size and the preview hint
......
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