summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorRodrigo Tobar <rtobar@icrar.org>2022-11-21 02:12:43 +0800
committerAndreas Kling <kling@serenityos.org>2022-11-30 14:51:14 +0100
commite7760483096d31d3b39066c5510fb985c88c3528 (patch)
treed086cdd1f6961ebfce758341d4508f09b27fc5c5 /Userland
parent9d4e0ba442c2cc8ed0378905fc15654f719824ce (diff)
downloadserenity-e7760483096d31d3b39066c5510fb985c88c3528.zip
LibPDF: Ignore whitespace on hex strings
The spec says that whitespaces should be ignored, but we weren't. PDFs with whitespaces in their hex strings were thus crushing the parser.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibPDF/Parser.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp
index 7c635ea6ac..6cd8136e40 100644
--- a/Userland/Libraries/LibPDF/Parser.cpp
+++ b/Userland/Libraries/LibPDF/Parser.cpp
@@ -364,6 +364,7 @@ String Parser::parse_hex_string()
int hex_value = 0;
for (int i = 0; i < 2; i++) {
+ m_reader.consume_whitespace();
auto ch = m_reader.consume();
if (ch == '>') {
// The hex string contains an odd number of characters, and the last character
@@ -373,7 +374,6 @@ String Parser::parse_hex_string()
builder.append(static_cast<char>(hex_value));
return builder.to_string();
}
-
VERIFY(isxdigit(ch));
hex_value *= 16;