aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2022-02-24 00:26:08 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2022-03-28 22:47:35 +0200
commit2063db041e5c756dff4dbcafdd8c63f9caf30cb9 (patch)
tree2c9fab2eab0f96be412406e14bf78bb9db7edc36
parent4e7092faaa492d8ac9580a05da8884245a193b4e (diff)
downloadffmpeg-2063db041e5c756dff4dbcafdd8c63f9caf30cb9.tar.gz
avformat/rmdec: Better duplicate tags check
Fixes: memleaks Fixes: 44810/clusterfuzz-testcase-minimized-ffmpeg_dem_IVR_fuzzer-5619494647627776 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 15a646e5018078a0954918f510f819a5599f0445) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/rmdec.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 29ed4d706e..7b9097e7ec 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -131,10 +131,6 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
uint32_t version;
int ret;
- // Duplicate tags
- if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
- return AVERROR_INVALIDDATA;
-
/* ra type header */
version = avio_rb16(pb); /* version */
if (version == 3) {
@@ -333,6 +329,11 @@ int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb,
if (codec_data_size == 0)
return 0;
+ // Duplicate tags
+ if ( st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN
+ && st->codecpar->codec_type != AVMEDIA_TYPE_DATA)
+ return AVERROR_INVALIDDATA;
+
avpriv_set_pts_info(st, 64, 1, 1000);
codec_pos = avio_tell(pb);
v = avio_rb32(pb);