Fix issues reported by valgrind Added a memset which is a potential fix to avoid the access of uninitialized memory in the convolve functions. BUG=aomedia:2670 Change-Id: I8fc9dd00e760db9c5104bfcc4af5612f3fea4652
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index c6ea53a..8563c2d 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -3359,13 +3359,20 @@ ThreadData *thread_data, int buf_size, int use_highbd) { for (int ref = 0; ref < 2; ref++) { + // The mc_buf/hbd_mc_buf must be zeroed to fix a intermittent valgrind error + // 'Conditional jump or move depends on uninitialised value' from the loop + // filter. Uninitialized reads in convolve function (e.g. horiz_4tap path in + // av1_convolve_2d_sr_avx2()) from mc_buf/hbd_mc_buf are seen to be the + // potential reason for this issue. if (use_highbd) { uint16_t *hbd_mc_buf; CHECK_MEM_ERROR(cm, hbd_mc_buf, (uint16_t *)aom_memalign(16, buf_size)); + memset(hbd_mc_buf, 0, buf_size); thread_data->mc_buf[ref] = CONVERT_TO_BYTEPTR(hbd_mc_buf); } else { CHECK_MEM_ERROR(cm, thread_data->mc_buf[ref], (uint8_t *)aom_memalign(16, buf_size)); + memset(thread_data->mc_buf[ref], 0, buf_size); } } thread_data->mc_buf_size = buf_size;