Commit 806922f643b05b50e423a7f16fc800dfd52ca8ef
1 parent
27980894
ascii85: ignore whitespace between ~ and > (fixes #973)
Showing
3 changed files
with
21 additions
and
11 deletions
ChangeLog
| 1 | 1 | 2023-09-03 Jay Berkenbilt <ejb@ql.org> |
| 2 | 2 | |
| 3 | + * ascii85 parser: ignore spaces everywhere including between ~ | |
| 4 | + and >. Fixes #973. | |
| 5 | + | |
| 3 | 6 | * Bug fix: with --pages, if one of the external files had warnings |
| 4 | 7 | but the main file did not, the warning was previously not taken |
| 5 | 8 | into consideration when determining the exit status. | ... | ... |
libqpdf/Pl_ASCII85Decoder.cc
| ... | ... | @@ -19,6 +19,17 @@ Pl_ASCII85Decoder::write(unsigned char const* buf, size_t len) |
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | 21 | for (size_t i = 0; i < len; ++i) { |
| 22 | + switch (buf[i]) { | |
| 23 | + case ' ': | |
| 24 | + case '\f': | |
| 25 | + case '\v': | |
| 26 | + case '\t': | |
| 27 | + case '\r': | |
| 28 | + case '\n': | |
| 29 | + QTC::TC("libtests", "Pl_ASCII85Decoder ignore space"); | |
| 30 | + // ignore whitespace | |
| 31 | + continue; | |
| 32 | + } | |
| 22 | 33 | if (eod > 1) { |
| 23 | 34 | break; |
| 24 | 35 | } else if (eod == 1) { |
| ... | ... | @@ -30,16 +41,6 @@ Pl_ASCII85Decoder::write(unsigned char const* buf, size_t len) |
| 30 | 41 | } |
| 31 | 42 | } else { |
| 32 | 43 | switch (buf[i]) { |
| 33 | - case ' ': | |
| 34 | - case '\f': | |
| 35 | - case '\v': | |
| 36 | - case '\t': | |
| 37 | - case '\r': | |
| 38 | - case '\n': | |
| 39 | - QTC::TC("libtests", "Pl_ASCII85Decoder ignore space"); | |
| 40 | - // ignore whitespace | |
| 41 | - break; | |
| 42 | - | |
| 43 | 44 | case '~': |
| 44 | 45 | eod = 1; |
| 45 | 46 | break; | ... | ... |
libtests/qtest/ascii85.test
| ... | ... | @@ -20,4 +20,10 @@ $td->runtest("partial decode", |
| 20 | 20 | $td->EXIT_STATUS => 0}, |
| 21 | 21 | $td->NORMALIZE_NEWLINES); |
| 22 | 22 | |
| 23 | -$td->report(2); | |
| 23 | +$td->runtest("newline between ~ and >", | |
| 24 | + {$td->COMMAND => "echo '\@<5skEHbu7\$3~\n>' | ascii85"}, | |
| 25 | + {$td->STRING => "asdfqwer\n", | |
| 26 | + $td->EXIT_STATUS => 0}, | |
| 27 | + $td->NORMALIZE_NEWLINES); | |
| 28 | + | |
| 29 | +$td->report(3); | ... | ... |