mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Utf8CodePointIterator: Don't output full string to debug output
When a code point is invalid, the full string was outputted to the debug output. For large strings, this can make the system quite slow. Furthermore, one of the cases incorrectly assumed the data to be null terminated. This patch modifies the debug statements not to print the full string. This fixes oss-fuzz issue 35050.
This commit is contained in:
parent
efae7b7748
commit
3c7e775a9a
Notes:
sideshowbarker
2024-07-18 12:37:22 +09:00
Author: https://github.com/MaxWipfli Commit: https://github.com/SerenityOS/serenity/commit/3c7e775a9a4 Pull-request: https://github.com/SerenityOS/serenity/pull/7918
1 changed files with 2 additions and 2 deletions
|
@ -246,13 +246,13 @@ u32 Utf8CodePointIterator::operator*() const
|
|||
|
||||
if (!first_byte_makes_sense) {
|
||||
// The first byte of the code point doesn't make sense: output a replacement character
|
||||
dbgln("First byte doesn't make sense, bytes: {}", StringView { (const char*)m_ptr, m_length });
|
||||
dbgln("First byte doesn't make sense: {:#02x}.", m_ptr[0]);
|
||||
return 0xFFFD;
|
||||
}
|
||||
|
||||
if (code_point_length_in_bytes > m_length) {
|
||||
// There is not enough data left for the full code point: output a replacement character
|
||||
dbgln("Not enough bytes (need {}, have {}), first byte is: {:#02x}, '{}'", code_point_length_in_bytes, m_length, m_ptr[0], (const char*)m_ptr);
|
||||
dbgln("Not enough bytes (need {}, have {}), first byte is: {:#02x}.", code_point_length_in_bytes, m_length, m_ptr[0]);
|
||||
return 0xFFFD;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue