Commit 62c1b42328832cc2ffe1bf4f10658738a192a192

Authored by Jay Berkenbilt
1 parent 70f9dc9a

detect degenerate case of empty xref table


git-svn-id: svn+q:///qpdf/trunk@970 71b93d88-0707-0410-a8cf-f5a4172ac649
Showing 1 changed file with 5 additions and 1 deletions
libqpdf/QPDF.cc
... ... @@ -538,7 +538,11 @@ QPDF::read_xref(off_t xref_offset)
538 538 }
539 539  
540 540 int size = this->trailer.getKey("/Size").getIntValue();
541   - int max_obj = (*(xref_table.rbegin())).first.obj;
  541 + int max_obj = 0;
  542 + if (! xref_table.empty())
  543 + {
  544 + (*(xref_table.rbegin())).first.obj;
  545 + }
542 546 if (! this->deleted_objects.empty())
543 547 {
544 548 max_obj = std::max(max_obj, *(this->deleted_objects.rbegin()));
... ...