From 54cdcd0d0640b4b0e135438e0fe445994bf9972a Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 25 Oct 2023 00:09:50 -0700 Subject: [PATCH] LibPDF: Reject non-hexdigits in hex string with error ...instead of VERIFY()ing input data. I haven't seen this in the wild, but since I'm here anyways, might as well fix this. --- Userland/Libraries/LibPDF/Parser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibPDF/Parser.cpp b/Userland/Libraries/LibPDF/Parser.cpp index 95f9c8dea6..eba8c21ad2 100644 --- a/Userland/Libraries/LibPDF/Parser.cpp +++ b/Userland/Libraries/LibPDF/Parser.cpp @@ -380,7 +380,9 @@ PDFErrorOr Parser::parse_hex_string() builder.append(static_cast(hex_value)); return builder.to_deprecated_string(); } - VERIFY(isxdigit(ch)); + + if (!isxdigit(ch)) + return error("character in hex string isn't hex digit"); hex_value *= 16; if (ch <= '9') {