aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2024-06-08 18:38:46 +1000
committerPeter Ross <pross@xvid.org>2024-11-21 19:41:12 +1100
commitf298507323a688bf89e9d3b44d7529edf80de909 (patch)
treeffaf512d6a2ba5de5b5d16c87aa535745c05b152 /libavcodec
parent66124bc36887676c9e25410925063eaecefd37d8 (diff)
downloadffmpeg-f298507323a688bf89e9d3b44d7529edf80de909.tar.gz
avcodec/mm: decode raw chunk type and skip unknown audio chunk type
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mmvideo.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index d339967702..7313507deb 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -39,6 +39,7 @@
#define MM_PREAMBLE_SIZE 6
+#define MM_TYPE_RAW 0x2
#define MM_TYPE_INTER 0x5
#define MM_TYPE_INTRA 0x8
#define MM_TYPE_INTRA_HH 0xc
@@ -76,6 +77,15 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
return 0;
}
+static int mm_decode_raw(MmContext * s)
+{
+ if (bytestream2_get_bytes_left(&s->gb) < s->avctx->width * s->avctx->height)
+ return AVERROR_INVALIDDATA;
+ for (int y = 0; y < s->avctx->height; y++)
+ bytestream2_get_buffer(&s->gb, s->frame->data[0] + y*s->frame->linesize[0], s->avctx->width);
+ return 0;
+}
+
static void mm_decode_pal(MmContext *s)
{
int start = bytestream2_get_le16(&s->gb);
@@ -202,6 +212,7 @@ static int mm_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
return res;
switch(type) {
+ case MM_TYPE_RAW : res = mm_decode_raw(s); break;
case MM_TYPE_PALETTE : mm_decode_pal(s); return avpkt->size;
case MM_TYPE_INTRA : res = mm_decode_intra(s, 0, 0); break;
case MM_TYPE_INTRA_HH : res = mm_decode_intra(s, 1, 0); break;