authorgravatar for 4678790+dweiller@users.noreply.github.comDominic <4678790+dweiller@users.noreply.github.com> 2023-01-24 13:14:06+11:00
committergravatar for 4678790+dweiller@users.noreply.github.comDominic <4678790+dweiller@users.noreply.github.com> 2023-02-20 09:09:06+11:00
log31d1cae8c68fbc765fd4394863b071788dbc9746
treed5e68f4e6d29f092207b4cf644ffe1594825c1bf
parent95953e1ee6a50229e21423aa2ac4e6929b37468a

std.compress.zstandard: validate fse table value count


1 files changed, 1 insertions(+), 2 deletions(-)

lib/std/compress/zstandard/decompress.zig+1-2
...@@ -1418,8 +1418,7 @@ fn decodeFseTable(...@@ -1418,8 +1418,7 @@ fn decodeFseTable(
1418 }1418 }
1419 bit_reader.alignToByte();1419 bit_reader.alignToByte();
14201420
1421 // TODO: check there are at least 2 non-zero probabilities1421 if (value_count < 2) return error.MalformedFseTable;
1422
1423 if (accumulated_probability != total_probability) return error.MalformedFseTable;1422 if (accumulated_probability != total_probability) return error.MalformedFseTable;
1424 if (value_count > expected_symbol_count) return error.MalformedFseTable;1423 if (value_count > expected_symbol_count) return error.MalformedFseTable;
14251424