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

skip checking png block crcs when fuzzing

Change-Id: If4671f7db2afb46dc68aa7a8a92c509e1735ab9f
Reviewed-on: https://gerrit.libreoffice.org/58051
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst aa415ee2
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <cassert> #include <cassert>
#include <memory> #include <memory>
#include <unotools/configmgr.hxx>
#include <vcl/pngread.hxx> #include <vcl/pngread.hxx>
#include <cmath> #include <cmath>
...@@ -134,6 +135,7 @@ private: ...@@ -134,6 +135,7 @@ private:
bool mbIDATComplete : 1; // true if finished with enough IDAT chunks bool mbIDATComplete : 1; // true if finished with enough IDAT chunks
bool mbpHYs : 1; // true if physical size of pixel available bool mbpHYs : 1; // true if physical size of pixel available
bool mbIgnoreGammaChunk : 1; bool mbIgnoreGammaChunk : 1;
bool mbIgnoreCRC : 1; // skip checking CRCs while fuzzing
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
// do some checks in debug mode // do some checks in debug mode
...@@ -214,6 +216,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream ) ...@@ -214,6 +216,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
mbIDATComplete( false ), mbIDATComplete( false ),
mbpHYs ( false ), mbpHYs ( false ),
mbIgnoreGammaChunk ( false ), mbIgnoreGammaChunk ( false ),
mbIgnoreCRC( utl::ConfigManager::IsFuzzing() ),
#if OSL_DEBUG_LEVEL > 0 #if OSL_DEBUG_LEVEL > 0
mnAllocSizeScanline(0), mnAllocSizeScanline(0),
mnAllocSizeScanlineAlpha(0), mnAllocSizeScanlineAlpha(0),
...@@ -306,7 +309,7 @@ bool PNGReaderImpl::ReadNextChunk() ...@@ -306,7 +309,7 @@ bool PNGReaderImpl::ReadNextChunk()
} }
sal_uInt32 nCheck(0); sal_uInt32 nCheck(0);
mrPNGStream.ReadUInt32( nCheck ); mrPNGStream.ReadUInt32( nCheck );
if( nCRC32 != nCheck ) if (!mbIgnoreCRC && nCRC32 != nCheck)
return false; return false;
} }
else else
......
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