diff --git a/src/serialization.cpp b/src/serialization.cpp index 4134126ca..0319b0159 100644 --- a/src/serialization.cpp +++ b/src/serialization.cpp @@ -262,6 +262,8 @@ void decompressZstd(std::istream &is, std::ostream &os) is.read(input_buffer, bufsize); input.size = is.gcount(); input.pos = 0; + if (input.size == 0) + throw SerializationError("decompressZstd: data ended too early"); } ret = ZSTD_decompressStream(stream.get(), &output, &input);