]> granicus.if.org Git - libvpx/commitdiff
vpx_scale: fix the issue in msan test.
authorjackychen <jackychen@google.com>
Fri, 30 Oct 2015 18:08:23 +0000 (11:08 -0700)
committerjackychen <jackychen@google.com>
Mon, 2 Nov 2015 20:36:10 +0000 (12:36 -0800)
Do memset to fix msan issue due to the access of uninitialized
memory.

BUG=https://code.google.com/p/chromium/issues/detail?id=549155

Change-Id: I02f995ede79e3574e72587cc078df1a0d11af002

vpx_scale/generic/yv12config.c

index 7739218138d9d58439becfd1a6bc68d399ef31b0..e1ee46eb7a020ce1980cd6e97d632a47f3a37094 100644 (file)
@@ -203,6 +203,15 @@ int vpx_realloc_frame_buffer(YV12_BUFFER_CONFIG *ybf,
         return -1;
 
       ybf->buffer_alloc = (uint8_t *)yv12_align_addr(fb->data, 32);
+
+#if defined(__has_feature)
+#if __has_feature(memory_sanitizer)
+      // This memset is needed for fixing the issue of using uninitialized
+      // value in msan test. It will cause a perf loss, so only do this for
+      // msan test.
+      memset(ybf->buffer_alloc, 0, (int)frame_size);
+#endif
+#endif
     } else if (frame_size > (size_t)ybf->buffer_alloc_sz) {
       // Allocation to hold larger frame, or first allocation.
       vpx_free(ybf->buffer_alloc);