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; delete splashOut;
Object globals; XRef *xref = doc.getXRef();
BaseStream *base_str = doc.getBaseStream(); int objNums = xref->getNumObjects();
if (base_str) { Object currentObj;
JBIG2Stream *str = new JBIG2Stream(base_str, &globals); for (int i = 0; i < objNums; ++i) {
str->reset(); if (xref->fetch(i, 0, &currentObj)->isStream()){
delete str; currentObj.getStream()->reset();
}
} }
globals.free(); currentObj.free();
} }
} catch (...) { } catch (...) {