Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
libnsgif: fix oob in lzw_decode
  • Loading branch information
sudhackar authored and hpjansson committed Jun 9, 2022
1 parent 56f1c73 commit e6ce374
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libnsgif/lzw.c
Expand Up @@ -329,6 +329,10 @@ lzw_result lzw_decode(struct lzw_ctx *ctx,
/* Code is invalid */
return LZW_BAD_CODE;

} else if (code_new >= 1 << LZW_CODE_MAX) {
/* Don't access out of bound */
return LZW_BAD_CODE;

} else if (code_new < current_entry) {
/* Code is in table */
code_out = code_new;
Expand Down

0 comments on commit e6ce374

Please sign in to comment.