diff options
author | Mika Lindqvist <postmaster@raasu.org> | 2017-08-17 21:35:15 +0300 |
---|---|---|
committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2017-08-24 12:35:36 +0200 |
commit | 725f7bc04c68d648abbdda7af62a0d4fc24ca848 (patch) | |
tree | 34dbad17d7adf6afe8ac3a7a2b0171cf43a21f0a /deflate_p.h | |
parent | 79a262f7a4da3b1ebb2d543df65ca8420c623a3f (diff) |
Fix that s->prev is not used uninitialized in insert_string_*
Diffstat (limited to 'deflate_p.h')
-rw-r--r-- | deflate_p.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/deflate_p.h b/deflate_p.h index b0d06ad..f5e8e4c 100644 --- a/deflate_p.h +++ b/deflate_p.h @@ -40,9 +40,11 @@ static inline Pos insert_string_c(deflate_state *const s, const Pos str, unsigne if (s->head[s->ins_h] != str+idx) { s->prev[(str+idx) & s->w_mask] = s->head[s->ins_h]; s->head[s->ins_h] = str+idx; + if (idx == count-1) { + ret = s->prev[(str+idx) & s->w_mask]; + } } } - ret = s->prev[(str+count-1) & s->w_mask]; return ret; } |