mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-05-28 12:50:20 +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;
|
||||
char currentByte;
|
||||
|
||||
while (true) {
|
||||
while (position < 32) {
|
||||
currentByte = readByte(data);
|
||||
value |= (currentByte & SEGMENT_BITS) << position;
|
||||
|
||||
if ((currentByte & CONTINUE_BIT) == 0) break;
|
||||
|
||||
position += 7;
|
||||
|
||||
if (position >= 32) throw Exception("VarInt is too big");
|
||||
}
|
||||
|
||||
if (position >= 32) throw Exception("VarInt is too big");
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user