Fix fuzz issues 15316 and 15390

This commit is contained in:
Jay Berkenbilt 2019-08-27 17:57:38 -04:00
parent 456c285b02
commit dadf8307c8
3 changed files with 9 additions and 0 deletions

View File

@ -0,0 +1,3 @@
1 0 obj<<2147483647 0 R>>
endobj
trailer<</Root 1 0 R>>

BIN
fuzz/qpdf_extra/15390.fuzz Normal file

Binary file not shown.

View File

@ -4,6 +4,7 @@
#include <vector>
#include <map>
#include <algorithm>
#include <limits>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
@ -2151,6 +2152,11 @@ QPDFObjectHandle
QPDF::makeIndirectObject(QPDFObjectHandle oh)
{
int max_objid = toI(getObjectCount());
if (max_objid == std::numeric_limits<int>::max())
{
throw std::range_error(
"max object id is too high to create new objects");
}
QPDFObjGen next(max_objid + 1, 0);
this->m->obj_cache[next] =
ObjCache(QPDFObjectHandle::ObjAccessor::getObject(oh), -1, -1);