lib/javacompat: Fixed JavaCompat::importJavaString() hanging when trying to import long strings
This was caused by an integer overflow due to using a too small data type in a counter variable.Soda
parent
48f8a7dcf2
commit
58b1199e38
|
@ -38,7 +38,7 @@ namespace JavaCompat {
|
||||||
return ErrorOr<tiny_utf8::string>(true, ErrorCodes::MISMATCHEDSIZE);
|
return ErrorOr<tiny_utf8::string>(true, ErrorCodes::MISMATCHEDSIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint8_t i=2; i<size+2; i++){
|
for(uint16_t i=2; i<size+2; i++){
|
||||||
if(i != 0){
|
if(i != 0){
|
||||||
if(data[i] == 0x80 && data[i-1] == 0xc0){
|
if(data[i] == 0x80 && data[i-1] == 0xc0){
|
||||||
stdString[stdString.length() - 1] = '\0';
|
stdString[stdString.length() - 1] = '\0';
|
||||||
|
|
Loading…
Reference in New Issue