mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
std.compress.zstandard: fix fse decoding crash
This commit is contained in:
parent
1c509f483a
commit
a625df4636
@ -46,6 +46,7 @@ pub fn decodeFseTable(
|
||||
if (value == 1) {
|
||||
while (true) {
|
||||
const repeat_flag = try bit_reader.readBitsNoEof(u2, 2);
|
||||
if (repeat_flag + value_count > 256) return error.MalformedFseTable;
|
||||
var i: usize = 0;
|
||||
while (i < repeat_flag) : (i += 1) {
|
||||
values[value_count] = 1;
|
||||
@ -54,6 +55,7 @@ pub fn decodeFseTable(
|
||||
if (repeat_flag < 3) break;
|
||||
}
|
||||
}
|
||||
if (value_count == 256) break;
|
||||
}
|
||||
bit_reader.alignToByte();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user