vp56: release frames on error
authorLuca Barbato <lu_zero@gentoo.org>
Fri, 14 Dec 2012 08:55:04 +0000 (09:55 +0100)
committerLuca Barbato <lu_zero@gentoo.org>
Fri, 14 Dec 2012 12:21:59 +0000 (13:21 +0100)
Fixes CVE-2012-2783

CC: libav-stable@libav.org
libavcodec/vp56.c

index 6779ffb..5bd0a1a 100644 (file)
@@ -514,8 +514,14 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
         s->modelp = &s->models[is_alpha];
 
         res = s->parse_header(s, buf, remaining_buf_size, &golden_frame);
-        if (res < 0)
+        if (res < 0) {
+            int i;
+            for (i = 0; i < 4; i++) {
+                if (s->frames[i].data[0])
+                    avctx->release_buffer(avctx, &s->frames[i]);
+            }
             return res;
+        }
 
         if (res == VP56_SIZE_CHANGE) {
             int i;