Merge "FPII-2476 :Denial of service vulnerability in Mediaserver CVE-2016-6712 A-30593752" into fp/fp2_5.1_int
diff --git a/libvpx/vp8/vp8_dx_iface.c b/libvpx/vp8/vp8_dx_iface.c
index 72e4770..e0bccc6 100644
--- a/libvpx/vp8/vp8_dx_iface.c
+++ b/libvpx/vp8/vp8_dx_iface.c
@@ -198,8 +198,8 @@
             si->h = (clear[8] | (clear[9] << 8)) & 0x3fff;
 
             /*printf("w=%d, h=%d\n", si->w, si->h);*/
-            if (!(si->h | si->w))
-                res = VPX_CODEC_UNSUP_BITSTREAM;
+            if (!(si->h && si->w))
+                res = VPX_CODEC_CORRUPT_FRAME;
         }
         else
         {
@@ -421,6 +421,10 @@
                 if (setjmp(pbi->common.error.jmp))
                 {
                     pbi->common.error.setjmp = 0;
+                /* on failure clear the cached resolution to ensure a full
+                * reallocation is attempted on resync. */
+                     ctx->si.w = 0;
+                     ctx->si.h = 0;
                     vp8_clear_system_state();
                     /* same return value as used in vp8dx_receive_compressed_data */
                     return -1;