1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-12 16:15:20 +02:00

zstd: Fix minetest.decompress lockup when data ends too early

This commit is contained in:
SmallJoker
2024-08-24 10:50:44 +02:00
committed by sfan5
parent da1fc9a536
commit 5583831c40

View File

@@ -262,6 +262,8 @@ void decompressZstd(std::istream &is, std::ostream &os)
is.read(input_buffer, bufsize); is.read(input_buffer, bufsize);
input.size = is.gcount(); input.size = is.gcount();
input.pos = 0; input.pos = 0;
if (input.size == 0)
throw SerializationError("decompressZstd: data ended too early");
} }
ret = ZSTD_decompressStream(stream.get(), &output, &input); ret = ZSTD_decompressStream(stream.get(), &output, &input);