diff options
Diffstat (limited to 'libavcodec/rscc.c')
-rw-r--r-- | libavcodec/rscc.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c index c54482f949..a2f7a0dc7c 100644 --- a/libavcodec/rscc.c +++ b/libavcodec/rscc.c @@ -2,20 +2,20 @@ * innoHeim/Rsupport Screen Capture Codec * Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com> * - * 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 */ @@ -80,7 +80,11 @@ static av_cold int rscc_init(AVCodecContext *avctx) if (!ctx->reference) return AVERROR(ENOMEM); - avctx->pix_fmt = AV_PIX_FMT_BGRA; + if (avctx->codec_tag == MKTAG('I','S','C','C')) { + avctx->pix_fmt = AV_PIX_FMT_BGRA; + } else { + avctx->pix_fmt = AV_PIX_FMT_BGR0; + } /* Store the value to check for keyframes */ ctx->inflated_size = avctx->width * avctx->height * 4; @@ -221,6 +225,11 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data, /* Get pixels buffer, it may be deflated or just raw */ if (pixel_size == packed_size) { + if (bytestream2_get_bytes_left(gbc) < pixel_size) { + av_log(avctx, AV_LOG_ERROR, "Insufficient input for %d\n", pixel_size); + ret = AVERROR_INVALIDDATA; + goto end; + } pixels = gbc->buffer; } else { uLongf len = ctx->inflated_size; |