]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vp3.c
h264: reset ref count if decoding the slice header fails
[ffmpeg] / libavcodec / vp3.c
index 467dfd565520e957bcee9394c174400394849ae8..adcecbcf043a20d88530cc2947007f6014bde5a9 100644 (file)
@@ -1543,7 +1543,11 @@ static void render_slice(Vp3DecodeContext *s, int slice)
                             uint8_t *temp= s->edge_emu_buffer;
                             if(stride<0) temp -= 8*stride;
 
-                            s->vdsp.emulated_edge_mc(temp, motion_source, stride, 9, 9, src_x, src_y, plane_width, plane_height);
+                            s->vdsp.emulated_edge_mc(temp, motion_source,
+                                                     stride, stride,
+                                                     9, 9, src_x, src_y,
+                                                     plane_width,
+                                                     plane_height);
                             motion_source= temp;
                         }
                     }
@@ -2166,6 +2170,7 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
     Vp3DecodeContext *s = avctx->priv_data;
     int visible_width, visible_height, colorspace;
     int offset_x = 0, offset_y = 0;
+    int ret;
     AVRational fps, aspect;
 
     s->theora = get_bits_long(gb, 24);
@@ -2182,12 +2187,6 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
     visible_width  = s->width  = get_bits(gb, 16) << 4;
     visible_height = s->height = get_bits(gb, 16) << 4;
 
-    if(av_image_check_size(s->width, s->height, 0, avctx)){
-        av_log(avctx, AV_LOG_ERROR, "Invalid dimensions (%dx%d)\n", s->width, s->height);
-        s->width= s->height= 0;
-        return -1;
-    }
-
     if (s->theora >= 0x030200) {
         visible_width  = get_bits_long(gb, 24);
         visible_height = get_bits_long(gb, 24);
@@ -2234,9 +2233,11 @@ static int theora_decode_header(AVCodecContext *avctx, GetBitContext *gb)
     if (   visible_width  <= s->width  && visible_width  > s->width-16
         && visible_height <= s->height && visible_height > s->height-16
         && !offset_x && (offset_y == s->height - visible_height))
-        avcodec_set_dimensions(avctx, visible_width, visible_height);
+        ret = ff_set_dimensions(avctx, visible_width, visible_height);
     else
-        avcodec_set_dimensions(avctx, s->width, s->height);
+        ret = ff_set_dimensions(avctx, s->width, s->height);
+    if (ret < 0)
+        return ret;
 
     if (colorspace == 1) {
         avctx->color_primaries = AVCOL_PRI_BT470M;