mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-15 14:02:20 +00:00
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.
This commit is contained in:
parent
9d4e0ba442
commit
e776048309
Notes:
sideshowbarker
2024-07-17 04:09:56 +09:00
Author: https://github.com/rtobar
Commit: e776048309
Pull-request: https://github.com/SerenityOS/serenity/pull/16135
Reviewed-by: https://github.com/TobyAsE
Reviewed-by: https://github.com/janso3 ✅
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue