mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-03 07:12:28 +00:00
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:
parent
da7166bead
commit
35d72c822e
@ -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
|
||||
|
@ -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 ---");
|
||||
|
3
qpdf/qtest/qpdf/append-page-content-damaged.out
Normal file
3
qpdf/qtest/qpdf/append-page-content-damaged.out
Normal 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
|
1592
qpdf/qtest/qpdf/append-page-content-damaged.pdf
Normal file
1592
qpdf/qtest/qpdf/append-page-content-damaged.pdf
Normal file
File diff suppressed because it is too large
Load Diff
1614
qpdf/qtest/qpdf/append-page-content-damaged.qdf
Normal file
1614
qpdf/qtest/qpdf/append-page-content-damaged.qdf
Normal file
File diff suppressed because it is too large
Load Diff
1408
qpdf/qtest/qpdf/append-page-content-good.qdf
Normal file
1408
qpdf/qtest/qpdf/append-page-content-good.qdf
Normal file
File diff suppressed because it is too large
Load Diff
1592
qpdf/qtest/qpdf/append-page-content.pdf
Normal file
1592
qpdf/qtest/qpdf/append-page-content.pdf
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user