fix possible infinite loop when transcoding from/to UTF-8
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user