libjpeg-turbo: enable i386 architecture and improve fuzzer regarding msan (#2680)

This commit is contained in:
Even Rouault 2019-08-12 18:34:37 +02:00 committed by jonathanmetzman
parent 8776ec2327
commit 5edcd421d9
2 changed files with 22 additions and 1 deletions

View File

@ -39,10 +39,28 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
return 0;
}
std::unique_ptr<unsigned char[]> buf(new unsigned char[width * height * 3]);
const int buffer_size = width * height * 3;
std::unique_ptr<unsigned char[]> buf(new unsigned char[buffer_size]);
tjDecompress2(
jpegDecompressor, data, size, buf.get(), width, 0, height, TJPF_RGB, 0);
// For memory sanitizer, test each output byte
const unsigned char* raw_buf = buf.get();
int count = 0;
for( int i = 0; i < buffer_size; i++ )
{
if (raw_buf[i])
{
count ++;
}
}
if (count == buffer_size)
{
// Do something with side effect, so that all the above tests don't
// get removed by the optimizer.
free(malloc(1));
}
tjDestroy(jpegDecompressor);
return 0;

View File

@ -3,3 +3,6 @@ sanitizers:
- address
- memory
- undefined
architectures:
- x86_64
- i386