]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vcr1.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / vcr1.c
index df5088c9b8a3e4b28d7163d9da076a469a5b8c17..2a4a0908850b9caa32cb9a5820d694fc761c59d6 100644 (file)
@@ -2,20 +2,20 @@
  * ATI VCR1 codec
  * Copyright (c) 2003 Michael Niedermayer
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
@@ -39,6 +39,7 @@ static av_cold int vcr1_common_init(AVCodecContext *avctx)
     VCR1Context *const a = avctx->priv_data;
 
     avctx->coded_frame = &a->picture;
+    avcodec_get_frame_defaults(&a->picture);
 
     return 0;
 }
@@ -76,6 +77,11 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data,
     if (p->data[0])
         avctx->release_buffer(avctx, p);
 
+    if(buf_size < 16 + avctx->height + avctx->width*avctx->height*5/8){
+        av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
+        return AVERROR(EINVAL);
+    }
+
     p->reference = 0;
     if (avctx->get_buffer(avctx, p) < 0) {
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");