diff options
Diffstat (limited to 'libavcodec/indeo3.c')
-rw-r--r-- | libavcodec/indeo3.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 30b70850f8..8e55fbe443 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -1,27 +1,29 @@ /* - * Intel Indeo 3 (IV31, IV32, etc.) video decoder for ffmpeg - * written, produced, and directed by Alan Smithee - * - * 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 */ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> +/** + * @file + * Intel Indeo 3 (IV31, IV32, etc.) video decoder for FFmpeg + * written, produced, and directed by Alan Smithee + * + * For some documentation see: + * http://wiki.multimedia.cx/index.php?title=Indeo_3 + */ #include "libavutil/imgutils.h" #include "avcodec.h" @@ -211,6 +213,7 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s, int *width_tbl, width_tbl_arr[10]; const signed char *ref_vectors; uint8_t *cur_frm_pos, *ref_frm_pos, *cp, *cp2; + uint8_t *cur_end = cur + width*height + width; uint32_t *cur_lp, *ref_lp; const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2]; uint8_t *correction_type_sp[2]; @@ -357,6 +360,8 @@ static void iv_Decode_Chunk(Indeo3DecodeContext *s, k = *buf1++; cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2]; ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2]; + if ((uint8_t *)cur_lp >= cur_end-3) + break; switch(correction_type_sp[0][k]) { case 0: @@ -967,6 +972,7 @@ static av_cold int indeo3_decode_init(AVCodecContext *avctx) s->width = avctx->width; s->height = avctx->height; avctx->pix_fmt = PIX_FMT_YUV410P; + avcodec_get_frame_defaults(&s->frame); if (!(ret = build_modpred(s))) ret = iv_alloc_frames(s); @@ -1134,6 +1140,9 @@ static av_cold int indeo3_decode_end(AVCodecContext *avctx) iv_free_func(s); + if (s->frame.data[0]) + avctx->release_buffer(avctx, &s->frame); + return 0; } |