commit 31d1cae8c68fbc765fd4394863b071788dbc9746 (tree)
parent 95953e1ee6a50229e21423aa2ac4e6929b37468a
Author: dweiller <4678790+dweiller@users.noreplay.github.com>
Date: Tue, 24 Jan 2023 13:14:06 +1100
std.compress.zstandard: validate fse table value count
Diffstat:
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/std/compress/zstandard/decompress.zig b/lib/std/compress/zstandard/decompress.zig
@@ -1418,8 +1418,7 @@ fn decodeFseTable(
}
bit_reader.alignToByte();
- // TODO: check there are at least 2 non-zero probabilities
-
+ if (value_count < 2) return error.MalformedFseTable;
if (accumulated_probability != total_probability) return error.MalformedFseTable;
if (value_count > expected_symbol_count) return error.MalformedFseTable;