Просмотр исходного кода

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.
Nico Weber 1 год назад
Родитель
Сommit
54cdcd0d06
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      Userland/Libraries/LibPDF/Parser.cpp

+ 3 - 1
Userland/Libraries/LibPDF/Parser.cpp

@@ -380,7 +380,9 @@ PDFErrorOr<DeprecatedString> Parser::parse_hex_string()
                     builder.append(static_cast<char>(hex_value));
                     builder.append(static_cast<char>(hex_value));
                     return builder.to_deprecated_string();
                     return builder.to_deprecated_string();
                 }
                 }
-                VERIFY(isxdigit(ch));
+
+                if (!isxdigit(ch))
+                    return error("character in hex string isn't hex digit");
 
 
                 hex_value *= 16;
                 hex_value *= 16;
                 if (ch <= '9') {
                 if (ch <= '9') {