summaryrefslogtreecommitdiff
path: root/libavformat/webmdashenc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-03-30 02:50:02 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-04-07 15:01:10 +0200
commitcbea58b2b35c6409e062c929f0b2ab763b8661eb (patch)
treeeb4d67018c77efb0ae4356d494063a8f121efe88 /libavformat/webmdashenc.c
parenta13841b79782eb09222d953e9c7d3cd00fefecf3 (diff)
avformat/webmdashenc: Check codec types
The WebM DASH Manifest muxer only supports VP8, VP9, Vorbis and Opus, but there was no check for this. The codec type is used to get a pointer to a string containing the codec name or NULL if it is not one of those four codecs. Said pointer has then been used without further checks as string for the %s conversion specifier in an avio_printf()) call which is undefined behaviour. This commit adds a check for the supported codec types. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/webmdashenc.c')
-rw-r--r--libavformat/webmdashenc.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c
index 7847659c63..016de8af6b 100644
--- a/libavformat/webmdashenc.c
+++ b/libavformat/webmdashenc.c
@@ -516,6 +516,14 @@ static int webm_dash_manifest_write_header(AVFormatContext *s)
double start = 0.0;
int ret;
WebMDashMuxContext *w = s->priv_data;
+
+ for (unsigned i = 0; i < s->nb_streams; i++) {
+ enum AVCodecID codec_id = s->streams[i]->codecpar->codec_id;
+ if (codec_id != AV_CODEC_ID_VP8 && codec_id != AV_CODEC_ID_VP9 &&
+ codec_id != AV_CODEC_ID_VORBIS && codec_id != AV_CODEC_ID_OPUS)
+ return AVERROR(EINVAL);
+ }
+
ret = parse_adaptation_sets(s);
if (ret < 0) {
goto fail;