diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2021-03-31 20:18:43 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2021-03-31 20:18:43 +0100 |
commit | e6c790fc877a231653f92b70c75a456812b5be0d (patch) | |
tree | a1f4658e6c8d3bc9d6d3c3fb859f40d3f6bd7251 | |
parent | 0d7049e414806b8af7f835cae9321138d4042a73 (diff) | |
download | libnsgif-e6c790fc877a231653f92b70c75a456812b5be0d.tar.gz libnsgif-e6c790fc877a231653f92b70c75a456812b5be0d.tar.bz2 |
lzw: Avoid code size increment check when dictionary is full.
-rw-r--r-- | src/lzw.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -357,11 +357,10 @@ lzw_result lzw_decode(struct lzw_ctx *ctx, lzw__dictionary_add_entry(ctx, (code_new < current_entry) ? table[code_new].first_value : ctx->previous_code_first); - } - /* Ensure code size is increased, if needed. */ - if (current_entry == ctx->current_code_size_max) { - if (ctx->current_code_size < LZW_CODE_MAX) { + /* Ensure code size is increased, if needed. */ + if (current_entry == ctx->current_code_size_max && + ctx->current_code_size < LZW_CODE_MAX) { ctx->current_code_size++; ctx->current_code_size_max = (1 << ctx->current_code_size) - 1; |