mirror of
https://github.com/gbdev/rgbds.git
synced 2026-08-25 00:04:38 +00:00
Fix infinite loop when a symbol name in an invalid object file starts with an invalid UTF-8 byte like 0xC0
This commit is contained in:
+1
-2
@@ -279,8 +279,7 @@ static void writeSymName(std::string const &name, FILE *file) {
|
||||
// Decode the UTF-8 codepoint; or at least attempt to
|
||||
Utf8Decoder decoder;
|
||||
do {
|
||||
if (decoder.update(*ptr) != UTF8_REJECT) {
|
||||
++ptr;
|
||||
if (decoder.update(*ptr++) != UTF8_REJECT) {
|
||||
continue;
|
||||
}
|
||||
// This sequence was invalid; emit a U+FFFD, and recover
|
||||
|
||||
Reference in New Issue
Block a user