serenity/Tests/LibPDF
Nico Weber 9495f64f91 LibPDF: Improve hex string parsing
A local (non-public) PDF I have lying around contains this in
a page's operator stream:

```
[<00b4003e> 3 <002600480051> 3 <005700550044004f0003> -29
<00330044> 3 <0055> -3 <004e0040> 4 <0003> -29 <004c00560003> -31
<0057004b> 4 <00480003> -37 <0050
>] TJ
```

That is, there's a newline in a hexstring after a character.

This led to `Parser error at offset 5184: Unexpected character`.

The spec says in 3.2.3 String Objects, Hexadecimal Strings:
"""Each pair of hexadecimal digits defines one byte of the string.
White-space characters (such as space, tab, carriage return, line feed,
and form feed) are ignored."""

But we didn't ignore whitespace before or after a character, only
in between the bytes.

The spec also says:
"""If the final digit of a hexadecimal string is missing—that is, if
there is an odd number of digits—the final digit is assumed to be 0."""

In that case, we were skipping the closing `>` twice -- or, more
accurately, we ignored the character after it too. This has been
wrong all the way back in #6974.

Add a test that fails if either of the two changes isn't present.
2024-01-02 22:13:21 +01:00
..
CMakeLists.txt Tests: Add a PDF rendering test 2023-12-20 12:45:07 +01:00
colorspaces.pdf Tests: Add a pdf file for testing color spaces 2023-11-04 17:02:37 -04:00
complex.pdf Tests: Move test PDF files into Tests/LibPDF 2023-01-19 11:50:10 +00:00
encoding.pdf LibPDF: Add (automated!) test for outline encoding 2023-11-22 09:08:06 -07:00
encryption_nocopy.pdf LibPDF: Make encrypted object streams work 2023-07-12 17:16:25 +02:00
linearized.pdf Tests: Move test PDF files into Tests/LibPDF 2023-01-19 11:50:10 +00:00
non-linearized.pdf Tests: Move test PDF files into Tests/LibPDF 2023-01-19 11:50:10 +00:00
oss-fuzz-testcase-62065.pdf LibPDF: Don't use unsanitized values in error messages 2023-10-26 11:05:32 +02:00
password-is-sup.pdf Tests/LibPDF: Add test for AES-encrypted PDF 2023-07-12 06:28:15 +02:00
pattern.pdf Tests: Add a test for LibPDF pattern rendering 2023-12-10 16:44:24 +01:00
TestPDF.cpp LibPDF: Improve hex string parsing 2024-01-02 22:13:21 +01:00
text.pdf LibPDF: Add a test for inter-word spacing with TJ 2023-11-14 10:11:09 +01:00
type1.pdf Tests: Move test PDF files into Tests/LibPDF 2023-01-19 11:50:10 +00:00
type3.pdf Tests: Add a type3 test pdf 2023-11-19 22:33:34 +01:00