fixing remaining overflows in BE/LE
This commit is contained in:
parent
541f0f2a41
commit
400218ba01
|
@ -196,17 +196,17 @@ proc finish*(pb: var ProtoBuffer) =
|
||||||
pb.offset = pos
|
pb.offset = pos
|
||||||
elif WithUint32BeLength in pb.options:
|
elif WithUint32BeLength in pb.options:
|
||||||
let size = uint(len(pb.buffer) - 4)
|
let size = uint(len(pb.buffer) - 4)
|
||||||
pb.buffer[0] = byte(size shr 24)
|
pb.buffer[0] = byte((size shr 24) and 0xFF)
|
||||||
pb.buffer[1] = byte(size shr 16)
|
pb.buffer[1] = byte((size shr 16) and 0xFF)
|
||||||
pb.buffer[2] = byte(size shr 8)
|
pb.buffer[2] = byte((size shr 8) and 0xFF)
|
||||||
pb.buffer[3] = byte(size and 0xFF)
|
pb.buffer[3] = byte(size and 0xFF)
|
||||||
pb.offset = 4
|
pb.offset = 4
|
||||||
elif WithUint32LeLength in pb.options:
|
elif WithUint32LeLength in pb.options:
|
||||||
let size = uint(len(pb.buffer) - 4)
|
let size = uint(len(pb.buffer) - 4)
|
||||||
pb.buffer[0] = byte(size and 0xFF)
|
pb.buffer[0] = byte(size and 0xFF)
|
||||||
pb.buffer[1] = byte(size shr 8)
|
pb.buffer[1] = byte((size shr 8) and 0xFF)
|
||||||
pb.buffer[2] = byte(size shr 16)
|
pb.buffer[2] = byte((size shr 16) and 0xFF)
|
||||||
pb.buffer[3] = byte(size shr 24)
|
pb.buffer[3] = byte((size shr 24) and 0xFF)
|
||||||
pb.offset = 4
|
pb.offset = 4
|
||||||
else:
|
else:
|
||||||
pb.offset = 0
|
pb.offset = 0
|
||||||
|
|
Loading…
Reference in New Issue