X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdsicinav.c;h=4d157b4655896e071bd1542fa70309fa5e53ddbc;hb=c755870d52c8c29676e5ba7ee9557adf4a7ca934;hp=7b36742279371506f5ee05dc92551e8e72bea8ed;hpb=fcae3ff124ee97c9265e3b93f3d41238b2aee9bd;p=ffmpeg diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index 7b367422793..4d157b46558 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -195,11 +195,13 @@ static void cin_decode_rle(const unsigned char *src, int src_size, while (src < src_end && dst < dst_end) { code = *src++; if (code & 0x80) { + if (src >= src_end) + break; len = code - 0x7F; memset(dst, *src++, FFMIN(len, dst_end - dst)); } else { len = code + 1; - memcpy(dst, src, FFMIN(len, dst_end - dst)); + memcpy(dst, src, FFMIN3(len, dst_end - dst, src_end - src)); src += len; } dst += len; @@ -241,6 +243,8 @@ static int cinvideo_decode_frame(AVCodecContext *avctx, } } + bitmap_frame_size = FFMIN(cin->bitmap_size, bitmap_frame_size); + /* note: the decoding routines below assumes that * surface.width = surface.pitch */ switch (bitmap_frame_type) { @@ -380,6 +384,7 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data, AVCodec ff_dsicinvideo_decoder = { .name = "dsicinvideo", + .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_DSICINVIDEO, .priv_data_size = sizeof(CinVideoContext), @@ -387,16 +392,15 @@ AVCodec ff_dsicinvideo_decoder = { .close = cinvideo_decode_end, .decode = cinvideo_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN video"), }; AVCodec ff_dsicinaudio_decoder = { .name = "dsicinaudio", + .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"), .type = AVMEDIA_TYPE_AUDIO, .id = AV_CODEC_ID_DSICINAUDIO, .priv_data_size = sizeof(CinAudioContext), .init = cinaudio_decode_init, .decode = cinaudio_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("Delphine Software International CIN audio"), };