From 783b1d1c113c5eba71f3c487fd70955c75608ba0 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 22 Feb 2024 09:41:58 -0500 Subject: [PATCH] LibPDF: Use is_ascii_hex_digit() instead of isxdigit() See description of #7684 for motivation. Also, makes this code look more like the hex code in Filter::decode_ascii_hex(). No behavior change. --- Userland/Libraries/LibPDF/Parser.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp index 30cc6d95dc..12fcf2e4b6 100644 --- a/Userland/Libraries/LibPDF/Parser.cpp +++ b/Userland/Libraries/LibPDF/Parser.cpp @@ -221,7 +221,7 @@ PDFErrorOr> Parser::parse_name() int hex_value = 0; for (int i = 0; i < 2; i++) { auto ch = m_reader.consume(); - VERIFY(isxdigit(ch)); + VERIFY(is_ascii_hex_digit(ch)); hex_value *= 16; if (ch <= '9') { hex_value += ch - '0'; @@ -370,7 +370,7 @@ PDFErrorOr Parser::parse_hex_string() return builder.to_byte_string(); } - if (!isxdigit(ch)) + if (!is_ascii_hex_digit(ch)) return error("character in hex string isn't hex digit"); hex_value *= 16;