Commit 402c69894c1b6ad3fe42c3d63d883afdac16b126
Committed by
GitHub
Merge pull request #1500 from m-holger/fuzz
Enhance `QPDFParser` sanity checks after xref recovery to include par…
Showing
1 changed file
with
11 additions
and
2 deletions
libqpdf/QPDFParser.cc
| @@ -40,7 +40,16 @@ QPDFParser::parse_content( | @@ -40,7 +40,16 @@ QPDFParser::parse_content( | ||
| 40 | { | 40 | { |
| 41 | bool empty = false; | 41 | bool empty = false; |
| 42 | return QPDFParser( | 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 | .parse(empty, true); | 53 | .parse(empty, true); |
| 45 | } | 54 | } |
| 46 | 55 | ||
| @@ -623,7 +632,7 @@ QPDFParser::tooManyBadTokens() | @@ -623,7 +632,7 @@ QPDFParser::tooManyBadTokens() | ||
| 623 | "encountered an array or dictionary with more than 5000 elements during xref recovery; " | 632 | "encountered an array or dictionary with more than 5000 elements during xref recovery; " |
| 624 | "giving up on reading object"); | 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 | good_count = 0; | 636 | good_count = 0; |
| 628 | bad_count = 1; | 637 | bad_count = 1; |
| 629 | return false; | 638 | return false; |