Spoofing out read_varint
continuous-integration/drone/push Build is failing Details

This commit is contained in:
Luke Murphy 2020-08-03 22:48:42 +02:00
parent 349a14293c
commit 0b99db4cf6
No known key found for this signature in database
GPG Key ID: 5E2EF5A63E3718CC
1 changed files with 17 additions and 2 deletions

View File

@ -64,8 +64,23 @@ class SimpleMessageChannel:
def _read_varint(self, data: bytes, offset: int) -> int:
"""TODO."""
pass
while offset < len(data):
self.varint += (data[offset] & 127) * self.factor
self.consumed += 1
def _next_state(self, data: bytes, offset: int) -> None:
if data[offset] < 128:
state = self._next_state(data, offset + 1)
if state:
return offset
return len(data)
offset += 1
if self.consumed >= 8:
raise RuntimeError("Incoming varint is invalid")
return len(data)
def _next_state(self, data: bytes, offset: int) -> bool:
"""TODO."""
pass