From 174a36f4ad25c2c9f29ecd148338c096479b59f1 Mon Sep 17 00:00:00 2001 From: Omar Roth Date: Tue, 8 Oct 2019 09:49:51 -0400 Subject: [PATCH] Fix overflow in VarLong --- src/protodec.cr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/protodec.cr b/src/protodec.cr index dec3623..575f710 100644 --- a/src/protodec.cr +++ b/src/protodec.cr @@ -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