Fuzz JBIG2 code by checking on each object in PDF file (#7508)

This commit is contained in:
Navidem 2022-04-04 17:54:35 -07:00 committed by GitHub
parent 8bad6b2c75
commit b3b6f748cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 7 deletions

View File

@ -118,14 +118,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
delete splashOut;
Object globals;
BaseStream *base_str = doc.getBaseStream();
if (base_str) {
JBIG2Stream *str = new JBIG2Stream(base_str, &globals);
str->reset();
delete str;
XRef *xref = doc.getXRef();
int objNums = xref->getNumObjects();
Object currentObj;
for (int i = 0; i < objNums; ++i) {
if (xref->fetch(i, 0, &currentObj)->isStream()){
currentObj.getStream()->reset();
}
}
globals.free();
currentObj.free();
}
} catch (...) {