summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-02-12 14:17:30 +0000
committerCaolán McNamara <caolanm@redhat.com>2018-02-12 21:36:26 +0100
commit10b6a2b2d6a5cb938ead02cba2fa03f748c5f63c (patch)
tree4864506f44d0831c1e83c4523bb263c4bb0c4973 /vcl/source
parent76c58b1cfbe2ab41b8e33d40953341410be7db96 (diff)
give up on recoverable errors earlier when fuzzing
Change-Id: I10b06a977f77c0802cbf5a1db33671ba1db69ba9 Reviewed-on: https://gerrit.libreoffice.org/49601 Tested-by: Jenkins <ci@libreoffice.org> 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/filter/jpeg/jpegc.cxx9
1 files changed, 6 insertions, 3 deletions
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index ddb5075fd817..8a8ea3707379 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -39,8 +39,6 @@ extern "C" {
#include <vcl/bitmapaccess.hxx>
#include <vcl/graphicfilter.hxx>
-#define WarningLimit 1000
-
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning (disable: 4324) /* disable to __declspec(align()) aligned warning */
@@ -72,6 +70,11 @@ extern "C" void outputMessage (j_common_ptr cinfo)
SAL_WARN("vcl.filter", "failure reading JPEG: " << buffer);
}
+static int GetWarningLimit()
+{
+ return utl::ConfigManager::IsFuzzing() ? 100 : 1000;
+}
+
extern "C" void emitMessage (j_common_ptr cinfo, int msg_level)
{
if (msg_level < 0)
@@ -80,7 +83,7 @@ extern "C" void emitMessage (j_common_ptr cinfo, int msg_level)
// reasonable limit (initially using ImageMagick's current limit of
// 1000), then bail.
// https://libjpeg-turbo.org/pmwiki/uploads/About/TwoIssueswiththeJPEGStandard.pdf
- if (cinfo->err->num_warnings++ > WarningLimit)
+ if (++cinfo->err->num_warnings > GetWarningLimit())
cinfo->err->error_exit(cinfo);
else
cinfo->err->output_message(cinfo);