shithub: libvpx

Download patch

ref: 1043474665fac5ac39cd69ea533136eb6bb68e73
parent: 80e5550723c60111ed77b00cf9b387846392cdef
parent: a07d09ff34885040187a83f4b4726f7b85b63e4c
author: James Zern <[email protected]>
date: Thu Aug 14 14:53:39 EDT 2014

Merge "vp9_copy_reference_dec: check ref frame index before use"

--- a/vp9/decoder/vp9_decoder.c
+++ b/vp9/decoder/vp9_decoder.c
@@ -123,8 +123,12 @@
    * later commit that adds VP9-specific controls for this functionality.
    */
   if (ref_frame_flag == VP9_LAST_FLAG) {
-    const YV12_BUFFER_CONFIG *const cfg =
-        &cm->frame_bufs[cm->ref_frame_map[0]].buf;
+    const YV12_BUFFER_CONFIG *const cfg = get_ref_frame(cm, 0);
+    if (cfg == NULL) {
+      vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
+                         "No 'last' reference frame");
+      return VPX_CODEC_ERROR;
+    }
     if (!equal_dimensions(cfg, sd))
       vpx_internal_error(&cm->error, VPX_CODEC_ERROR,
                          "Incorrect buffer dimensions");