Handle jpeg library fuzz false positives

The jpeg library has some assembly code that is missed by the compiler
instrumentation used by memory sanitization. There is a runtime
environment variable that is used to work around this issue.
This commit is contained in:
Jay Berkenbilt 2020-10-22 06:27:25 -04:00
parent c1684eae91
commit 232f5fc9f3
3 changed files with 13 additions and 0 deletions

View File

@ -2,6 +2,7 @@
#include <qpdf/Pl_DCT.hh>
#include <iostream>
#include <stdexcept>
#include <cstdlib>
class FuzzHelper
{
@ -46,6 +47,11 @@ FuzzHelper::run()
extern "C" int LLVMFuzzerTestOneInput(unsigned char const* data, size_t size)
{
#ifndef _WIN32
// Used by jpeg library to work around false positives in memory
// sanitizer.
setenv("JSIMD_FORCENONE", "1", 1);
#endif
FuzzHelper f(data, size);
f.run();
return 0;

View File

@ -9,6 +9,7 @@
#include <qpdf/QPDFPageLabelDocumentHelper.hh>
#include <qpdf/QPDFOutlineDocumentHelper.hh>
#include <qpdf/QPDFAcroFormDocumentHelper.hh>
#include <cstdlib>
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
{
@ -223,6 +224,11 @@ FuzzHelper::run()
extern "C" int LLVMFuzzerTestOneInput(unsigned char const* data, size_t size)
{
#ifndef _WIN32
// Used by jpeg library to work around false positives in memory
// sanitizer.
setenv("JSIMD_FORCENONE", "1", 1);
#endif
FuzzHelper f(data, size);
f.run();
return 0;

View File

@ -8,6 +8,7 @@
#include <stdexcept>
#include <stdlib.h>
#include <string>
#include <cstring>
#if BITS_IN_JSAMPLE != 8
# error "qpdf does not support libjpeg built with BITS_IN_JSAMPLE != 8"