mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-29 21:30:18 +02:00
remove infinite loop from readVarInt()
This commit is contained in:
parent
873232ebe3
commit
8b90a9f2b3
@ -117,17 +117,17 @@ int McClient::readVarInt(QByteArray &data) {
|
|||||||
int position = 0;
|
int position = 0;
|
||||||
char currentByte;
|
char currentByte;
|
||||||
|
|
||||||
while (true) {
|
while (position < 32) {
|
||||||
currentByte = readByte(data);
|
currentByte = readByte(data);
|
||||||
value |= (currentByte & SEGMENT_BITS) << position;
|
value |= (currentByte & SEGMENT_BITS) << position;
|
||||||
|
|
||||||
if ((currentByte & CONTINUE_BIT) == 0) break;
|
if ((currentByte & CONTINUE_BIT) == 0) break;
|
||||||
|
|
||||||
position += 7;
|
position += 7;
|
||||||
|
|
||||||
if (position >= 32) throw Exception("VarInt is too big");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (position >= 32) throw Exception("VarInt is too big");
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user