Commit 413c8c0f924f387bf5bbfb208ba4be34db4d1265

Authored by m-holger
1 parent b73f6d79

Enhance `QPDFParser` sanity checks after xref recovery to include parsing of content streams.

Showing 1 changed file with 11 additions and 2 deletions
libqpdf/QPDFParser.cc
... ... @@ -40,7 +40,16 @@ QPDFParser::parse_content(
40 40 {
41 41 bool empty = false;
42 42 return QPDFParser(
43   - input, std::move(sp_description), "content", tokenizer, nullptr, context, true)
  43 + input,
  44 + std::move(sp_description),
  45 + "content",
  46 + tokenizer,
  47 + nullptr,
  48 + context,
  49 + true,
  50 + 0,
  51 + 0,
  52 + context && context->reconstructed_xref())
44 53 .parse(empty, true);
45 54 }
46 55  
... ... @@ -623,7 +632,7 @@ QPDFParser::tooManyBadTokens()
623 632 "encountered an array or dictionary with more than 5000 elements during xref recovery; "
624 633 "giving up on reading object");
625 634 }
626   - if (--max_bad_count > 0 && good_count > 4) {
  635 + if (max_bad_count && --max_bad_count > 0 && good_count > 4) {
627 636 good_count = 0;
628 637 bad_count = 1;
629 638 return false;
... ...