shithub: libvpx

Download patch

ref: 8cbeb7cf3604c42bdd1b11b2235667695a1f7e20
parent: b573fef76d2a00ed54c6e94e529f9b4eaaf64ac3
author: Yaowu Xu <[email protected]>
date: Thu Mar 5 09:57:11 EST 2015

Prevent invalid memory access

Change-Id: I1b972c945274254d896d772d859840b2f8211b4f

--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -748,8 +748,11 @@
 #else
       const BLOCK_SIZE bs = get_plane_block_size(BLOCK_64X64, pd);
 #endif
-      uv_sad = cpi->fn_ptr[bs].sdf(p->src.buf, p->src.stride,
-                                   pd->dst.buf, pd->dst.stride);
+      if (bs == BLOCK_INVALID)
+        uv_sad = INT_MAX;
+      else
+        uv_sad = cpi->fn_ptr[bs].sdf(p->src.buf, p->src.stride,
+                                     pd->dst.buf, pd->dst.stride);
 
 #if GLOBAL_MOTION
       x->color_sensitivity[i - 1] = uv_sad * 4 > y_sad;