mirror of
https://github.com/qpdf/qpdf.git
synced 2024-12-22 19:08:59 +00:00
Handle zlib data errors better (fixes #106)
This commit is contained in:
parent
07d6f770b2
commit
6a7d53ad2b
@ -1,5 +1,7 @@
|
|||||||
2017-07-29 Jay Berkenbilt <ejb@ql.org>
|
2017-07-29 Jay Berkenbilt <ejb@ql.org>
|
||||||
|
|
||||||
|
* Handle zlib data errors when decoding streams. Fixes #106.
|
||||||
|
|
||||||
* Improve handling of files where the "stream" keyword is not
|
* Improve handling of files where the "stream" keyword is not
|
||||||
followed by proper line terminators. Fixes #104.
|
followed by proper line terminators. Fixes #104.
|
||||||
|
|
||||||
|
@ -157,6 +157,8 @@ Pl_Flate::handleData(unsigned char* data, int len, int flush)
|
|||||||
void
|
void
|
||||||
Pl_Flate::finish()
|
Pl_Flate::finish()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
if (this->outbuf)
|
if (this->outbuf)
|
||||||
{
|
{
|
||||||
if (this->initialized)
|
if (this->initialized)
|
||||||
@ -180,6 +182,12 @@ Pl_Flate::finish()
|
|||||||
delete [] this->outbuf;
|
delete [] this->outbuf;
|
||||||
this->outbuf = 0;
|
this->outbuf = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
this->getNext()->finish();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
this->getNext()->finish();
|
this->getNext()->finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2206,7 +2206,7 @@ QPDF::pipeStreamData(int objid, int generation,
|
|||||||
warn(e);
|
warn(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (std::runtime_error& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
if (! suppress_warnings)
|
if (! suppress_warnings)
|
||||||
{
|
{
|
||||||
@ -2218,7 +2218,14 @@ QPDF::pipeStreamData(int objid, int generation,
|
|||||||
QUtil::int_to_string(generation) + ": " + e.what()));
|
QUtil::int_to_string(generation) + ": " + e.what()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
pipeline->finish();
|
pipeline->finish();
|
||||||
|
}
|
||||||
|
catch (std::exception&)
|
||||||
|
{
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ $td->runtest("remove page we don't have",
|
|||||||
show_ntests();
|
show_ntests();
|
||||||
# ----------
|
# ----------
|
||||||
$td->notify("--- Miscellaneous Tests ---");
|
$td->notify("--- Miscellaneous Tests ---");
|
||||||
$n_tests += 88;
|
$n_tests += 89;
|
||||||
|
|
||||||
$td->runtest("qpdf version",
|
$td->runtest("qpdf version",
|
||||||
{$td->COMMAND => "qpdf --version"},
|
{$td->COMMAND => "qpdf --version"},
|
||||||
@ -229,6 +229,7 @@ foreach my $d (
|
|||||||
["118", "other infinite loop", 2],
|
["118", "other infinite loop", 2],
|
||||||
["119", "other infinite loop", 3],
|
["119", "other infinite loop", 3],
|
||||||
["120", "other infinite loop", 3],
|
["120", "other infinite loop", 3],
|
||||||
|
["106", "zlib data error", 3],
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
my ($n, $description, $exit_status) = @$d;
|
my ($n, $description, $exit_status) = @$d;
|
||||||
|
4
qpdf/qtest/qpdf/issue-106.out
Normal file
4
qpdf/qtest/qpdf/issue-106.out
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
WARNING: issue-106.pdf (file position 56627): error decoding stream data for object 29 0: stream inflate: inflate: data: incorrect data check
|
||||||
|
WARNING: issue-106.pdf (file position 64303): error decoding stream data for object 30 0: stream inflate: inflate: data: incorrect data check
|
||||||
|
WARNING: issue-106.pdf (file position 67427): error decoding stream data for object 31 0: stream inflate: inflate: data: incorrect data check
|
||||||
|
qpdf: operation succeeded with warnings; resulting file may have some problems
|
BIN
qpdf/qtest/qpdf/issue-106.pdf
Normal file
BIN
qpdf/qtest/qpdf/issue-106.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user