Skip to content
This repository has been archived by the owner on May 2, 2021. It is now read-only.

Commit

Permalink
Fix overflow in VarLong
Browse files Browse the repository at this point in the history
  • Loading branch information
omarroth committed Oct 8, 2019
1 parent 496a5f3 commit 174a36f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/protodec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ struct VarLong

def self.to_io(io : IO, value : Int64)
io.write_byte 0x00 if value == 0x00
value = value.to_u64
value = value.to_u64!

while value != 0
byte = (value & 0x7f).to_u8
byte = (value & 0x7f).to_u8!
value >>= 7

if value != 0
Expand Down

0 comments on commit 174a36f

Please sign in to comment.