mirror of
https://github.com/gbdev/rgbds.git
synced 2026-09-05 05:17:06 +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
|
// Decode the UTF-8 codepoint; or at least attempt to
|
||||||
Utf8Decoder decoder;
|
Utf8Decoder decoder;
|
||||||
do {
|
do {
|
||||||
if (decoder.update(*ptr) != UTF8_REJECT) {
|
if (decoder.update(*ptr++) != UTF8_REJECT) {
|
||||||
++ptr;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// This sequence was invalid; emit a U+FFFD, and recover
|
// This sequence was invalid; emit a U+FFFD, and recover
|
||||||
|
|||||||
Reference in New Issue
Block a user