std.compress.zstandard: fix dictionary field size

This commit is contained in:
dweiller 2023-01-24 13:10:45 +11:00
parent 6b85373875
commit 95953e1ee6

View File

@ -898,8 +898,8 @@ pub fn decodeZStandardHeader(src: []const u8, consumed_count: ?*usize) !frame.ZS
var dictionary_id: ?u32 = null;
if (descriptor.dictionary_id_flag > 0) {
// if flag is 3 we field_size = 4, else field_size = flag
const field_size = (@as(u3, 1) << descriptor.dictionary_id_flag) >> 1;
// if flag is 3 then field_size = 4, else field_size = flag
const field_size = (@as(u4, 1) << descriptor.dictionary_id_flag) >> 1;
dictionary_id = readVarInt(u32, src[bytes_read_count .. bytes_read_count + field_size]);
bytes_read_count += field_size;
}