mirror of https://github.com/qpdf/qpdf.git
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:
parent
c1684eae91
commit
232f5fc9f3
|
@ -2,6 +2,7 @@
|
||||||
#include <qpdf/Pl_DCT.hh>
|
#include <qpdf/Pl_DCT.hh>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
class FuzzHelper
|
class FuzzHelper
|
||||||
{
|
{
|
||||||
|
@ -46,6 +47,11 @@ FuzzHelper::run()
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(unsigned char const* data, size_t size)
|
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);
|
FuzzHelper f(data, size);
|
||||||
f.run();
|
f.run();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <qpdf/QPDFPageLabelDocumentHelper.hh>
|
#include <qpdf/QPDFPageLabelDocumentHelper.hh>
|
||||||
#include <qpdf/QPDFOutlineDocumentHelper.hh>
|
#include <qpdf/QPDFOutlineDocumentHelper.hh>
|
||||||
#include <qpdf/QPDFAcroFormDocumentHelper.hh>
|
#include <qpdf/QPDFAcroFormDocumentHelper.hh>
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
|
class DiscardContents: public QPDFObjectHandle::ParserCallbacks
|
||||||
{
|
{
|
||||||
|
@ -223,6 +224,11 @@ FuzzHelper::run()
|
||||||
|
|
||||||
extern "C" int LLVMFuzzerTestOneInput(unsigned char const* data, size_t size)
|
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);
|
FuzzHelper f(data, size);
|
||||||
f.run();
|
f.run();
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#if BITS_IN_JSAMPLE != 8
|
#if BITS_IN_JSAMPLE != 8
|
||||||
# error "qpdf does not support libjpeg built with BITS_IN_JSAMPLE != 8"
|
# error "qpdf does not support libjpeg built with BITS_IN_JSAMPLE != 8"
|
||||||
|
|
Loading…
Reference in New Issue