X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdfa.c;h=13d1e71f820654b86b24e4a8cfab29d7ab8d61bf;hb=1c7f252783aec37e4ff8049476386f63afe91756;hp=970175fb734680e6812145c002f95dd54e068623;hpb=762c2b5dcd99a08452299cd1f83070f88115f1f3;p=ffmpeg diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index 970175fb734..13d1e71f820 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -332,7 +332,7 @@ static const chunk_decoder decoder[8] = { decode_tdlt, decode_dsw1, decode_blck, decode_dds1, }; -static const char * const chunk_name[8] = { +static const char chunk_name[8][5] = { "COPY", "TSW1", "BDLT", "WDLT", "TDLT", "DSW1", "BLCK", "DDS1" }; @@ -355,6 +355,8 @@ static int dfa_decode_frame(AVCodecContext *avctx, bytestream2_init(&gb, avpkt->data, avpkt->size); while (bytestream2_get_bytes_left(&gb) > 0) { + if (bytestream2_get_bytes_left(&gb) < 12) + return AVERROR_INVALIDDATA; bytestream2_skip(&gb, 4); chunk_size = bytestream2_get_le32(&gb); chunk_type = bytestream2_get_le32(&gb); @@ -412,7 +414,7 @@ static av_cold int dfa_decode_end(AVCodecContext *avctx) return 0; } -AVCodec ff_dfa_decoder = { +const AVCodec ff_dfa_decoder = { .name = "dfa", .long_name = NULL_IF_CONFIG_SMALL("Chronomaster DFA"), .type = AVMEDIA_TYPE_VIDEO,