Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/codec_par: do not copy AVChannelLayout struct directly
@ 2022-03-15 14:28 Marton Balint
  2022-03-15 15:10 ` James Almer
  0 siblings, 1 reply; 2+ messages in thread
From: Marton Balint @ 2022-03-15 14:28 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Marton Balint

Later we use av_channel_layout_copy, but that uninits the struct
unintentionally freeing the possibly allocated u.map pointer.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavcodec/codec_par.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
index e4b329c838..abda649aa8 100644
--- a/libavcodec/codec_par.c
+++ b/libavcodec/codec_par.c
@@ -78,6 +78,7 @@ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src
     codec_parameters_reset(dst);
     memcpy(dst, src, sizeof(*dst));
 
+    dst->ch_layout      = (AVChannelLayout){0};
     dst->extradata      = NULL;
     dst->extradata_size = 0;
     if (src->extradata) {
-- 
2.31.1

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [FFmpeg-devel] [PATCH] avcodec/codec_par: do not copy AVChannelLayout struct directly
  2022-03-15 14:28 [FFmpeg-devel] [PATCH] avcodec/codec_par: do not copy AVChannelLayout struct directly Marton Balint
@ 2022-03-15 15:10 ` James Almer
  0 siblings, 0 replies; 2+ messages in thread
From: James Almer @ 2022-03-15 15:10 UTC (permalink / raw)
  To: ffmpeg-devel

On 3/15/2022 11:28 AM, Marton Balint wrote:
> Later we use av_channel_layout_copy, but that uninits the struct
> unintentionally freeing the possibly allocated u.map pointer.
> 
> Signed-off-by: Marton Balint <cus@passwd.hu>
> ---
>   libavcodec/codec_par.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/libavcodec/codec_par.c b/libavcodec/codec_par.c
> index e4b329c838..abda649aa8 100644
> --- a/libavcodec/codec_par.c
> +++ b/libavcodec/codec_par.c
> @@ -78,6 +78,7 @@ int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src
>       codec_parameters_reset(dst);
>       memcpy(dst, src, sizeof(*dst));
>   
> +    dst->ch_layout      = (AVChannelLayout){0};
>       dst->extradata      = NULL;
>       dst->extradata_size = 0;
>       if (src->extradata) {

LGTM.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-15 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-15 14:28 [FFmpeg-devel] [PATCH] avcodec/codec_par: do not copy AVChannelLayout struct directly Marton Balint
2022-03-15 15:10 ` James Almer

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git