From: Archana Polampalli <archana.polampa...@windriver.com> FFmpeg version n6.1.1 has a double-free vulnerability in the fftools/ffmpeg_mux_init.c component of FFmpeg, specifically within the new_stream_audio function.
Signed-off-by: Archana Polampalli <archana.polampa...@windriver.com> --- .../ffmpeg/ffmpeg/CVE-2024-35365.patch | 62 +++++++++++++++++++ .../recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb | 1 + 2 files changed, 63 insertions(+) create mode 100644 meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2024-35365.patch diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2024-35365.patch b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2024-35365.patch new file mode 100644 index 0000000000..2b5646e07c --- /dev/null +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg/CVE-2024-35365.patch @@ -0,0 +1,62 @@ +From ced5c5fdb8634d39ca9472a2026b2d2fea16c4e5 Mon Sep 17 00:00:00 2001 +From: Andreas Rheinhardt <andreas.rheinha...@outlook.com> +Date: Mon, 25 Mar 2024 16:54:25 +0100 +Subject: [PATCH] fftools/ffmpeg_mux_init: Fix double-free on error + +MATCH_PER_STREAM_OPT iterates over all options of a given +OptionDef and tests whether they apply to the current stream; +if so, they are set to ost->apad, otherwise, the code errors +out. If no error happens, ost->apad is av_strdup'ed in order +to take ownership of this pointer. + +But this means that setting it originally was premature, +as it leads to double-frees when an error happens lateron. +This can simply be reproduced with +ffmpeg -filter_complex anullsrc -apad bar -apad:n baz -f null - +This is a regression since 83ace80bfd80fcdba2c65fa1d554923ea931d5bd. + +Fix this by using a temporary variable instead of directly +setting ost->apad. Also only strdup the string if it actually +is != NULL. + +Reviewed-by: Marth64 <mart...@proxyid.net> +Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> + +CVE: CVE-2024-35365 + +Upstream-Status: Backport [https://github.com/ffmpeg/ffmpeg/commit/ced5c5fdb8634d39ca9472a2026b2d2fea16c4e5] + +Signed-off-by: Archana Polampalli <archana.polampa...@windriver.com> +--- + fftools/ffmpeg_mux_init.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c +index 63a25a3..685c064 100644 +--- a/fftools/ffmpeg_mux_init.c ++++ b/fftools/ffmpeg_mux_init.c +@@ -845,6 +845,7 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, + int channels = 0; + char *layout = NULL; + char *sample_fmt = NULL; ++ const char *apad = NULL; + + MATCH_PER_STREAM_OPT(audio_channels, i, channels, oc, st); + if (channels) { +@@ -882,8 +883,12 @@ static int new_stream_audio(Muxer *mux, const OptionsContext *o, + + MATCH_PER_STREAM_OPT(audio_sample_rate, i, audio_enc->sample_rate, oc, st); + +- MATCH_PER_STREAM_OPT(apad, str, ost->apad, oc, st); +- ost->apad = av_strdup(ost->apad); ++ MATCH_PER_STREAM_OPT(apad, str, apad, oc, st); ++ if (apad) { ++ ost->apad = av_strdup(apad); ++ if (!ost->apad) ++ return AVERROR(ENOMEM); ++ } + + #if FFMPEG_OPT_MAP_CHANNEL + /* check for channel mapping for this audio stream */ +-- +2.40.0 diff --git a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb index c3cfc87669..fb3f954904 100644 --- a/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb +++ b/meta/recipes-multimedia/ffmpeg/ffmpeg_6.1.1.bb @@ -40,6 +40,7 @@ SRC_URI = " \ file://CVE-2024-35366.patch \ file://CVE-2024-35367.patch \ file://CVE-2024-35368.patch \ + file://CVE-2024-35365.patch \ " SRC_URI[sha256sum] = "8684f4b00f94b85461884c3719382f1261f0d9eb3d59640a1f4ac0873616f968" -- 2.40.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#210984): https://lists.openembedded.org/g/openembedded-core/message/210984 Mute This Topic: https://lists.openembedded.org/mt/111053954/21656 Group Owner: openembedded-core+ow...@lists.openembedded.org Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-