]> granicus.if.org Git - libvpx/commitdiff
vp9_copy_reference_dec: check ref frame index before use
authorJames Zern <jzern@google.com>
Thu, 14 Aug 2014 21:56:08 +0000 (14:56 -0700)
committerJames Zern <jzern@google.com>
Thu, 14 Aug 2014 21:57:54 +0000 (14:57 -0700)
use get_ref_frame() to ensure a valid frame is retrieved if one exists

Change-Id: I4b116d928e643ee62a991babd4b974037b6b3830

vp9/decoder/vp9_decoder.c

index 2a2f0f5faa26ef4a7cb1cfe417ab24e53446b0ee..1a4155825c496cc6b4e8d9e0389748026af0ea1b 100644 (file)
@@ -123,8 +123,12 @@ vpx_codec_err_t vp9_copy_reference_dec(VP9Decoder *pbi,
    * 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");