diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2019-09-04 23:41:22 +0300 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-09-05 16:37:39 +0200 |
commit | 55197ed4ef1ab39ede3598bc20d074023f9ec8d7 (patch) | |
tree | fa2900e360e94e65f2ba96d0609fdda352ba30f0 /AK | |
parent | c379f43d2a130f7bc22c471ef88bac94f4fe21cd (diff) | |
download | serenity-55197ed4ef1ab39ede3598bc20d074023f9ec8d7.zip |
AK: Log UTF-8 validation errors
Diffstat (limited to 'AK')
-rw-r--r-- | AK/Utf8View.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/AK/Utf8View.cpp b/AK/Utf8View.cpp index 7e404522cd..ad54c164ed 100644 --- a/AK/Utf8View.cpp +++ b/AK/Utf8View.cpp @@ -1,4 +1,5 @@ #include <AK/Utf8View.h> +#include <AK/LogStream.h> namespace AK { @@ -134,7 +135,13 @@ u32 Utf8CodepointIterator::operator*() const int codepoint_length_in_bytes; bool first_byte_makes_sense = decode_first_byte(m_ptr[0], codepoint_length_in_bytes, codepoint_value_so_far); + if (!first_byte_makes_sense) { + dbg() << "First byte doesn't make sense, bytes = " << (const char*)m_ptr; + } ASSERT(first_byte_makes_sense); + if (codepoint_length_in_bytes > m_length) { + dbg() << "Not enough bytes (need " << codepoint_length_in_bytes << ", have " << m_length << "), first byte is: " << m_ptr[0] << " " << (const char*)m_ptr; + } ASSERT(codepoint_length_in_bytes <= m_length); for (int offset = 1; offset < codepoint_length_in_bytes; offset++) { |