diff options
Diffstat (limited to 'libavcodec/dxa.c')
-rw-r--r-- | libavcodec/dxa.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c index e634bbecfc..d57398b8fb 100644 --- a/libavcodec/dxa.c +++ b/libavcodec/dxa.c @@ -2,20 +2,20 @@ * Feeble Files/ScummVM DXA decoder * Copyright (c) 2007 Konstantin Shishkov * - * 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 */ @@ -210,7 +210,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac r = *buf++; g = *buf++; b = *buf++; - c->pal[i] = (r << 16) | (g << 8) | b; + c->pal[i] = 0xFFU << 24 | r << 16 | g << 8 | b; } pc = 1; buf_size -= 768+4; @@ -257,7 +257,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac c->pic.key_frame = !(compr & 1); c->pic.pict_type = (compr & 1) ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; for(j = 0; j < avctx->height; j++){ - if(compr & 1){ + if((compr & 1) && tmpptr){ for(i = 0; i < avctx->width; i++) outptr[i] = srcptr[i] ^ tmpptr[i]; tmpptr += stride; @@ -271,6 +271,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac case 13: c->pic.key_frame = 0; c->pic.pict_type = AV_PICTURE_TYPE_P; + if (!c->prev.data[0]) { + av_log(avctx, AV_LOG_ERROR, "Missing reference frame\n"); + return AVERROR_INVALIDDATA; + } decode_13(avctx, c, c->pic.data[0], srcptr, c->prev.data[0]); break; default: @@ -295,6 +299,9 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx->pix_fmt = AV_PIX_FMT_PAL8; + avcodec_get_frame_defaults(&c->pic); + avcodec_get_frame_defaults(&c->prev); + c->dsize = avctx->width * avctx->height * 2; if((c->decomp_buf = av_malloc(c->dsize)) == NULL) { av_log(avctx, AV_LOG_ERROR, "Can't allocate decompression buffer.\n"); |