Support an odd number of digits in hexadecimal strings (issue 18645)

See https://opensource.adobe.com/dc-acrobat-sdk-docs/pdfstandards/PDF32000_2008.pdf#G6.1840792
This commit is contained in:
Jonas Jenwald 2024-08-23 16:06:54 +02:00
parent 908f453384
commit 8728f7f134
5 changed files with 28 additions and 20 deletions

View file

@ -201,11 +201,12 @@ describe("parser", function () {
});
describe("getHexString", function () {
it("should not throw exception on bad input", function () {
// '7 0 2 15 5 2 2 2 4 3 2 4' should be parsed as '70 21 55 22 24 32'.
it("should handle an odd number of digits", function () {
// '7 0 2 15 5 2 2 2 4 3 2 4' should be parsed as
// '70 21 55 22 24 32 40'.
const input = new StringStream("<7 0 2 15 5 2 2 2 4 3 2 4>");
const lexer = new Lexer(input);
expect(lexer.getHexString()).toEqual('p!U"$2');
expect(lexer.getHexString()).toEqual('p!U"$2@');
});
});