better recovery for appended files with damaged cross-reference tables

git-svn-id: svn+q:///qpdf/trunk@648 71b93d88-0707-0410-a8cf-f5a4172ac649
This commit is contained in:
Jay Berkenbilt 2009-02-21 02:31:08 +00:00
parent da7166bead
commit 35d72c822e
7 changed files with 6234 additions and 1 deletions

View File

@ -116,3 +116,4 @@ QPDFWriter not recompressing /FlateDecode 0
QPDF piping xref stream from encrypted file 0
unable to filter 0
QPDF_String non-trivial UTF-16 0
QPDF xref overwrite object 0

View File

@ -152,7 +152,7 @@ for (my $i = 1; $i <= scalar(@badfiles); ++$i)
show_ntests();
# ----------
$td->notify("--- Recovery Tests ---");
$n_tests += @badfiles + 2;
$n_tests += @badfiles + 6;
# Recovery tests. These are mostly after-the-fact -- when recovery
# was implemented, some degree of recovery was possible on many of the
@ -189,6 +189,29 @@ $td->runtest("check output",
{$td->FILE => "a.pdf"},
{$td->FILE => "heifer.qdf"});
# See if we can recover the cross reference table on a file that has
# been appended to even when it deletes and reuses objects. We can't
# completely do it in the case of deleted objects, but we can get
# mostly there.
$td->runtest("good replaced page contents",
{$td->COMMAND =>
"qpdf --static-id -qdf append-page-content.pdf a.pdf"},
{$td->STRING => "",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("check output",
{$td->FILE => "a.pdf"},
{$td->FILE => "append-page-content-good.qdf"});
$td->runtest("damaged replaced page contents",
{$td->COMMAND => "qpdf --static-id -qdf" .
" append-page-content-damaged.pdf a.pdf"},
{$td->FILE => "append-page-content-damaged.out",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("check output",
{$td->FILE => "a.pdf"},
{$td->FILE => "append-page-content-damaged.qdf"});
show_ntests();
# ----------
$td->notify("--- Basic Parsing Tests ---");

View File

@ -0,0 +1,3 @@
WARNING: append-page-content-damaged.pdf: offset 0: file is damaged
WARNING: append-page-content-damaged.pdf: can't find startxref
WARNING: Attempting to reconstruct cross-reference table

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff