8000 Fixed #31. Was using the ReadBits_Fast method instead of ReadBits in … · coderforlife/ms-compress@d70aefe · GitHub
[go: up one dir, main page]

Skip to content

Commit d70aefe

Browse files
committed
Fixed #31. Was using the ReadBits_Fast method instead of ReadBits in the full bounds-checking loop.
1 parent 158667a commit d70aefe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/xpress_huff_decompress.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ static MSCompStatus xpress_huff_decompress_chunk(const_bytes* _in, const const_b
108108
{
109109
const uint_fast8_t off_bits = (uint_fast8_t)((sym>>4) & 0xF);
110110
if (UNLIKELY(off_bits > bstr.AvailableBits())) { PRINT_ERROR("XPRESS Huffman Decompression Error: Invalid data: Unable to read %u bits for offset\n", sym); return MSCOMP_DATA_ERROR; }
111-
off = bstr.ReadBits_Fast(off_bits) + (1 << off_bits);
111+
off = bstr.ReadBits(off_bits) + (1 << off_bits);
112112
}
113113
if (UNLIKELY(out - off < out_origin)) { PRINT_ERROR("XPRESS Huffman Decompression Error: Invalid data: Illegal offset (%p-%u < %p)\n", out, off, out_origin); return MSCOMP_DATA_ERROR; }
114114
if (UNLIKELY(out + len > out_end)) { PRINT_ERROR("XPRESS Huffman Decompression Error: Insufficient buffer\n"); return MSCOMP_BUF_ERROR; }

0 commit comments

Comments
 (0)
0