diff mbox series

[FFmpeg-devel,v3,2/2] libavformat/oggparseopus: Clear existing stream metadata before parsing potentially new one. Fixes: #10363

Message ID 20230514213741.34312-2-toots@rastageeks.org
State New
Headers show
Series [FFmpeg-devel,v3,1/2] libavformat/oggparseflac: Decode metadata packets. Fixes: #10364 | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Romain Beauxis May 14, 2023, 9:37 p.m. UTC
From: Romain Beauxis <toots@rastageeks.org>

This is the third version of a series of patches improving metadata support in
chained ogg streams.

Previous versions of this patch were including changes that were later
identified as issues from another encoded and fixed there. See:
https://github.com/savonet/liquidsoap/pull/3062

The remaining changes address a memory leak in chained ogg/opus stream
metadata. Reproduction steps for the issue are detailed in:
https://trac.ffmpeg.org/ticket/10363

---
 libavformat/oggparseopus.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Romain Beauxis May 19, 2023, 12:50 a.m. UTC | #1
Hello again!

I wanted to see if there was any interest in this patch and the other one
adding metadata decoding for chained ogg bitstream. These two feel like
easy bugfixes and features to add to the next release.

Reproduction steps for this one are detailed here:
https://trac.ffmpeg.org/ticket/10363

-- Romain

Le dim. 14 mai 2023 à 16:42, <toots@rastageeks.org> a écrit :

> From: Romain Beauxis <toots@rastageeks.org>
>
> This is the third version of a series of patches improving metadata
> support in
> chained ogg streams.
>
> Previous versions of this patch were including changes that were later
> identified as issues from another encoded and fixed there. See:
> https://github.com/savonet/liquidsoap/pull/3062
>
> The remaining changes address a memory leak in chained ogg/opus stream
> metadata. Reproduction steps for the issue are detailed in:
> https://trac.ffmpeg.org/ticket/10363
>
> ---
>  libavformat/oggparseopus.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
> index 54aa725be6..86977b41db 100644
> --- a/libavformat/oggparseopus.c
> +++ b/libavformat/oggparseopus.c
> @@ -80,6 +80,7 @@ static int opus_header(AVFormatContext *avf, int idx)
>      if (priv->need_comments) {
>          if (os->psize < 8 || memcmp(packet, "OpusTags", 8))
>              return AVERROR_INVALIDDATA;
> +        av_dict_free(&st->metadata);
>          ff_vorbis_stream_comment(avf, st, packet + 8, os->psize - 8);
>          priv->need_comments--;
>          return 1;
> --
> 2.37.1 (Apple Git-137.1)
>
>
Paul B Mahol Sept. 11, 2023, 10:05 a.m. UTC | #2
Is this real leak as reported by valgrind or similar?
diff mbox series

Patch

diff --git a/libavformat/oggparseopus.c b/libavformat/oggparseopus.c
index 54aa725be6..86977b41db 100644
--- a/libavformat/oggparseopus.c
+++ b/libavformat/oggparseopus.c
@@ -80,6 +80,7 @@  static int opus_header(AVFormatContext *avf, int idx)
     if (priv->need_comments) {
         if (os->psize < 8 || memcmp(packet, "OpusTags", 8))
             return AVERROR_INVALIDDATA;
+        av_dict_free(&st->metadata);
         ff_vorbis_stream_comment(avf, st, packet + 8, os->psize - 8);
         priv->need_comments--;
         return 1;