diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2021-03-31 20:18:43 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2021-04-05 14:51:52 +0100 |
commit | ce2543b41e3394c5cf3161d49f1561ba34f674a2 (patch) | |
tree | b6694c0b39261511812190a37f0b36339a19505c | |
parent | 55c00227e1ad7cd7e03cc377fdaf052d57a56a06 (diff) | |
download | libnsgif-ce2543b41e3394c5cf3161d49f1561ba34f674a2.tar.gz libnsgif-ce2543b41e3394c5cf3161d49f1561ba34f674a2.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; |