diff options
author | hkuang <hkuang@google.com> | 2014-01-09 10:36:50 -0800 |
---|---|---|
committer | hkuang <hkuang@google.com> | 2014-01-10 10:24:21 -0800 |
commit | 66c6f7bf61fd0e5915cccb832dea62ce7fe4262e (patch) | |
tree | 001e479e0d3bed7318cac78ced6462b61940858f | |
parent | f16b186b8ead1ff7ddac7d3d00b3bab2f829c946 (diff) | |
download | libvpx-66c6f7bf61fd0e5915cccb832dea62ce7fe4262e.tar.gz libvpx-66c6f7bf61fd0e5915cccb832dea62ce7fe4262e.tar.bz2 libvpx-66c6f7bf61fd0e5915cccb832dea62ce7fe4262e.zip |
Fix Issue #679: vp9 C loop filter produces valgrind warning.
Fix the valgrind error due to access uninitialized
memory in loopfilter.
Change-Id: I52fccf5ede845ee1f4c13d3bd909b8f220c0bdff
-rw-r--r-- | vpx_scale/generic/yv12config.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/vpx_scale/generic/yv12config.c b/vpx_scale/generic/yv12config.c index fc05d8ca7..994e8430c 100644 --- a/vpx_scale/generic/yv12config.c +++ b/vpx_scale/generic/yv12config.c @@ -175,6 +175,11 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, return -1; } + // This memset is needed for fixing valgrind error from C loop filter + // due to access uninitialized memory in frame border. It could be + // removed if border is totally removed. + vpx_memset(ext_fb->data, 0, ext_fb->size); + ybf->buffer_alloc = yv12_align_addr(ext_fb->data, 32); } } else { @@ -183,16 +188,21 @@ int vp9_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf, if (ybf->buffer_alloc) vpx_free(ybf->buffer_alloc); ybf->buffer_alloc = vpx_memalign(32, frame_size); + if (!ybf->buffer_alloc) + return -1; + ybf->buffer_alloc_sz = frame_size; + + // This memset is needed for fixing valgrind error from C loop filter + // due to access uninitialized memory in frame boarder. It could be + // removed if border is totally removed. + vpx_memset(ybf->buffer_alloc, 0, ybf->buffer_alloc_sz); } if (ybf->buffer_alloc_sz < frame_size) return -1; } - if (!ybf->buffer_alloc) - return -1; - /* Only support allocating buffers that have a border that's a multiple * of 32. The border restriction is required to get 16-byte alignment of * the start of the chroma rows without introducing an arbitrary gap |