2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-23 03:18:59 +00:00

Add specially crafted test cases for EOF error

This replaces a PDF from the wild that I didn't want to include in the
test suite but used to verify the original fix.
This commit is contained in:
Jay Berkenbilt 2012-08-11 12:36:57 -04:00
parent 29e9c34fe3
commit 3c4110184c
6 changed files with 20 additions and 6 deletions

5
TODO
View File

@ -5,11 +5,6 @@ Next
mention in latest release notes including that it was inadvertently mention in latest release notes including that it was inadvertently
left out of the release notes for 3.0.0. left out of the release notes for 3.0.0.
* EOF while reading token causes a tokenizer error even when a valid
token is ready. This can happen in an object stream if there is no
newline or whitespace character at the end and the last token in
the object stream is not an array or dictionary.
General General
======= =======

View File

@ -149,7 +149,7 @@ $td->runtest("remove page we don't have",
$td->NORMALIZE_NEWLINES); $td->NORMALIZE_NEWLINES);
# ---------- # ----------
$td->notify("--- Miscellaneous Tests ---"); $td->notify("--- Miscellaneous Tests ---");
$n_tests += 45; $n_tests += 47;
$td->runtest("qpdf version", $td->runtest("qpdf version",
{$td->COMMAND => "qpdf --version"}, {$td->COMMAND => "qpdf --version"},
@ -374,6 +374,14 @@ $td->runtest("parse objects from string",
{$td->COMMAND => "test_driver 31 minimal.pdf"}, # file not used {$td->COMMAND => "test_driver 31 minimal.pdf"}, # file not used
{$td->FILE => "parse-object.out", $td->EXIT_STATUS => 0}, {$td->FILE => "parse-object.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES); $td->NORMALIZE_NEWLINES);
$td->runtest("EOF terminating literal tokens",
{$td->COMMAND => "qpdf --check eof-terminates-literal.pdf"},
{$td->FILE => "eof-terminates-literal.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("EOF reading token",
{$td->COMMAND => "qpdf --check eof-reading-token.pdf"},
{$td->FILE => "eof-reading-token.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
show_ntests(); show_ntests();
# ---------- # ----------

View File

@ -0,0 +1,5 @@
checking eof-reading-token.pdf
PDF Version: 1.3
File is not encrypted
File is not linearized
object stream 12 (file position 5): EOF while reading token

Binary file not shown.

View File

@ -0,0 +1,6 @@
checking eof-terminates-literal.pdf
PDF Version: 1.3
File is not encrypted
File is not linearized
No syntax or stream encoding errors found; the file may still contain
errors that qpdf cannot detect

Binary file not shown.