2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

ascii85: ignore whitespace between ~ and > (fixes #973)

This commit is contained in:
Jay Berkenbilt 2023-09-03 13:56:02 -04:00
parent 27980894bd
commit 806922f643
3 changed files with 21 additions and 11 deletions

View File

@ -1,5 +1,8 @@
2023-09-03 Jay Berkenbilt <ejb@ql.org>
* ascii85 parser: ignore spaces everywhere including between ~
and >. Fixes #973.
* Bug fix: with --pages, if one of the external files had warnings
but the main file did not, the warning was previously not taken
into consideration when determining the exit status.

View File

@ -19,6 +19,17 @@ Pl_ASCII85Decoder::write(unsigned char const* buf, size_t len)
return;
}
for (size_t i = 0; i < len; ++i) {
switch (buf[i]) {
case ' ':
case '\f':
case '\v':
case '\t':
case '\r':
case '\n':
QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
// ignore whitespace
continue;
}
if (eod > 1) {
break;
} else if (eod == 1) {
@ -30,16 +41,6 @@ Pl_ASCII85Decoder::write(unsigned char const* buf, size_t len)
}
} else {
switch (buf[i]) {
case ' ':
case '\f':
case '\v':
case '\t':
case '\r':
case '\n':
QTC::TC("libtests", "Pl_ASCII85Decoder ignore space");
// ignore whitespace
break;
case '~':
eod = 1;
break;

View File

@ -20,4 +20,10 @@ $td->runtest("partial decode",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->report(2);
$td->runtest("newline between ~ and >",
{$td->COMMAND => "echo '\@<5skEHbu7\$3~\n>' | ascii85"},
{$td->STRING => "asdfqwer\n",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->report(3);