fix possible infinite loop when transcoding from/to UTF-8

This commit is contained in:
wmayer
2019-02-14 11:06:30 +01:00
parent 2066464ff1
commit 87f4106b24

View File

@@ -157,6 +157,10 @@ inline StrXUTF8::StrXUTF8(const XMLCh* const toTranscode)
str.append((const char*)outBuff, outputLength);
offset += eaten;
inputLength -= eaten;
// Bail out if nothing more was produced
if (outputLength == 0)
break;
}
}
@@ -274,6 +278,10 @@ inline XUTF8Str::XUTF8Str(const char* const fromTranscode)
str.append(outBuff, outputLength);
offset += eaten;
inputLength -= eaten;
// Bail out if nothing more was produced
if (outputLength == 0)
break;
}
delete[] charSizes;