Check for zero-length binary streams
This commit is contained in:
parent
154ffb6cd8
commit
201cb7c68e
|
@ -545,6 +545,7 @@ proc encode*[E](pr: Preserve[E]): seq[byte] =
|
|||
|
||||
proc decodePreserves*(s: Stream; E = void): Preserve[E] =
|
||||
## Decode a Preserves value from a binary-encoded stream.
|
||||
if s.atEnd: raise newException(ValueError, "End of Preserves stream")
|
||||
proc assertStream(check: bool) =
|
||||
if not check:
|
||||
raise newException(ValueError, "invalid Preserves stream")
|
||||
|
|
Loading…
Reference in New Issue