zstd: Fix minetest.decompress lockup when data ends too early
Some checks are pending
android / build (push) Waiting to run
cpp_lint / clang_tidy (push) Waiting to run
linux / gcc_7 (push) Waiting to run
linux / gcc_14 (push) Waiting to run
linux / clang_7 (push) Waiting to run
linux / clang_18 (push) Waiting to run
linux / clang_11 (PROMETHEUS=1) (push) Waiting to run
macos / build (push) Waiting to run
whitespace_checks / trailing_whitespaces (push) Waiting to run
whitespace_checks / tabs_lua_api_files (push) Waiting to run
windows / MinGW cross-compiler (${{ matrix.bits }}-bit) (32) (push) Waiting to run
windows / MinGW cross-compiler (${{ matrix.bits }}-bit) (64) (push) Waiting to run
windows / VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }} (map[arch:x64 generator:-G'Visual Studio 16 2019' -A x64 vcpkg_triplet:x64-windows], portable) (push) Waiting to run
windows / VS 2019 ${{ matrix.config.arch }}-${{ matrix.type }} (map[arch:x86 generator:-G'Visual Studio 16 2019' -A Win32 vcpkg_triplet:x86-windows], portable) (push) Waiting to run

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);
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);