From 57d737c7204581835289fd70fb5b83ca9c436e65 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 7 Jan 2017 22:34:32 -0800 Subject: [PATCH] hc_matchfinder: use well-defined initialization of best_matchptr The initial value of best_matchptr is not truly used, but since we do always compute 'in_next - best_matchptr', assign an initial value which avoids undefined behavior. --- include/wimlib/hc_matchfinder.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wimlib/hc_matchfinder.h b/include/wimlib/hc_matchfinder.h index aa2e4542..b0c8c65a 100644 --- a/include/wimlib/hc_matchfinder.h +++ b/include/wimlib/hc_matchfinder.h @@ -197,7 +197,7 @@ TEMPLATED(hc_matchfinder_longest_match)(struct TEMPLATED(hc_matchfinder) * const { const u8 *in_next = in_begin + cur_pos; u32 depth_remaining = max_search_depth; - const u8 *best_matchptr = best_matchptr; /* uninitialized */ + const u8 *best_matchptr = in_next; mf_pos_t cur_node3, cur_node4; u32 hash3, hash4; u32 next_seq3, next_seq4; -- 2.43.0