summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-07-26 09:58:47 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-07-26 14:05:50 +0200
commit62955bb8145c95991f7771eb7efb0dc46f744ef5 (patch)
treebc37ea3774ecfb07427d34dc1c5a72efac96507e /vcl/source
parentaa415ee2d6b8816c9a280321660e20c41c59e896 (diff)
skip checking png block crcs when fuzzing
Change-Id: If4671f7db2afb46dc68aa7a8a92c509e1735ab9f Reviewed-on: https://gerrit.libreoffice.org/58051 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/gdi/pngread.cxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/vcl/source/gdi/pngread.cxx b/vcl/source/gdi/pngread.cxx
index f00a096f5573..f4195fd5c352 100644
--- a/vcl/source/gdi/pngread.cxx
+++ b/vcl/source/gdi/pngread.cxx
@@ -21,6 +21,7 @@
#include <cassert>
#include <memory>
+#include <unotools/configmgr.hxx>
#include <vcl/pngread.hxx>
#include <cmath>
@@ -134,6 +135,7 @@ private:
bool mbIDATComplete : 1; // true if finished with enough IDAT chunks
bool mbpHYs : 1; // true if physical size of pixel available
bool mbIgnoreGammaChunk : 1;
+ bool mbIgnoreCRC : 1; // skip checking CRCs while fuzzing
#if OSL_DEBUG_LEVEL > 0
// do some checks in debug mode
@@ -214,6 +216,7 @@ PNGReaderImpl::PNGReaderImpl( SvStream& rPNGStream )
mbIDATComplete( false ),
mbpHYs ( false ),
mbIgnoreGammaChunk ( false ),
+ mbIgnoreCRC( utl::ConfigManager::IsFuzzing() ),
#if OSL_DEBUG_LEVEL > 0
mnAllocSizeScanline(0),
mnAllocSizeScanlineAlpha(0),
@@ -306,7 +309,7 @@ bool PNGReaderImpl::ReadNextChunk()
}
sal_uInt32 nCheck(0);
mrPNGStream.ReadUInt32( nCheck );
- if( nCRC32 != nCheck )
+ if (!mbIgnoreCRC && nCRC32 != nCheck)
return false;
}
else