Merge pull request #4553 from jepler/decompress-length-fix

decompress: Fix decompression when length takes 7 bits
This commit is contained in:
Dan Halbert 2021-04-04 14:21:09 -04:00 committed by GitHub
commit 57e70adc69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -86,7 +86,7 @@ uint16_t decompress_length(const compressed_string_t *compressed) {
char *decompress(const compressed_string_t *compressed, char *decompressed) {
uint8_t this_byte = compress_max_length_bits / 8;
uint8_t this_bit = 7 - compress_max_length_bits % 8;
uint8_t b = (&compressed->data)[this_byte];
uint8_t b = (&compressed->data)[this_byte] << (compress_max_length_bits % 8);
uint16_t length = decompress_length(compressed);
// Stop one early because the last byte is always NULL.