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 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure
@ 2024-06-11 13:44 Michael Niedermayer
  2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 2/4] avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds Michael Niedermayer
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-06-11 13:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1503078 Resource leak

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/af_aresample.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_aresample.c b/libavfilter/af_aresample.c
index d6bd77beb32..8ff2fe5973f 100644
--- a/libavfilter/af_aresample.c
+++ b/libavfilter/af_aresample.c
@@ -195,8 +195,11 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamplesref)
     av_frame_copy_props(outsamplesref, insamplesref);
     outsamplesref->format                = outlink->format;
     ret = av_channel_layout_copy(&outsamplesref->ch_layout, &outlink->ch_layout);
-    if (ret < 0)
+    if (ret < 0) {
+        av_frame_free(&outsamplesref);
+        av_frame_free(&insamplesref);
         return ret;
+    }
     outsamplesref->sample_rate           = outlink->sample_rate;
 
     if(insamplesref->pts != AV_NOPTS_VALUE) {
-- 
2.45.2

_______________________________________________
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] 5+ messages in thread

* [FFmpeg-devel] [PATCH 2/4] avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds
  2024-06-11 13:44 [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure Michael Niedermayer
@ 2024-06-11 13:44 ` Michael Niedermayer
  2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 3/4] avfilter/af_mcompand: compute half frequency in double Michael Niedermayer
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-06-11 13:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Maybe Helps: CID1503077 Bad bit shift operation

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/af_channelsplit.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/af_channelsplit.c b/libavfilter/af_channelsplit.c
index 1c4e815c6ef..43b26677505 100644
--- a/libavfilter/af_channelsplit.c
+++ b/libavfilter/af_channelsplit.c
@@ -22,7 +22,7 @@
  *
  * Split an audio stream into per-channel streams.
  */
-
+#include "libavutil/avassert.h"
 #include "libavutil/attributes.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/internal.h"
@@ -157,6 +157,8 @@ static int filter_frame(AVFilterLink *outlink, AVFrame *buf)
     enum AVChannel channel = av_channel_layout_channel_from_index(&buf->ch_layout, s->map[i]);
     int ret;
 
+    av_assert1(channel >= 0);
+
     AVFrame *buf_out = av_frame_clone(buf);
     if (!buf_out)
         return AVERROR(ENOMEM);
-- 
2.45.2

_______________________________________________
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] 5+ messages in thread

* [FFmpeg-devel] [PATCH 3/4] avfilter/af_mcompand: compute half frequency in double
  2024-06-11 13:44 [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure Michael Niedermayer
  2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 2/4] avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds Michael Niedermayer
@ 2024-06-11 13:44 ` Michael Niedermayer
  2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 4/4] avfilter/af_pan: check nb_output_channels before use Michael Niedermayer
  2024-07-07 20:13 ` [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure Michael Niedermayer
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-06-11 13:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1422217 Result is not floating-point

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/af_mcompand.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/af_mcompand.c b/libavfilter/af_mcompand.c
index 89fe806a021..e63820efceb 100644
--- a/libavfilter/af_mcompand.c
+++ b/libavfilter/af_mcompand.c
@@ -418,8 +418,8 @@ static int config_output(AVFilterLink *outlink)
         }
 
         new_nb_items += sscanf(tstr2, "%lf", &s->bands[i].topfreq) == 1;
-        if (s->bands[i].topfreq < 0 || s->bands[i].topfreq >= outlink->sample_rate / 2) {
-            av_log(ctx, AV_LOG_ERROR, "crossover_frequency: %f, should be >=0 and lower than half of sample rate: %d.\n", s->bands[i].topfreq, outlink->sample_rate / 2);
+        if (s->bands[i].topfreq < 0 || s->bands[i].topfreq >= outlink->sample_rate / 2.0) {
+            av_log(ctx, AV_LOG_ERROR, "crossover_frequency: %f, should be >=0 and lower than half of sample rate: %f.\n", s->bands[i].topfreq, outlink->sample_rate / 2.0);
             return AVERROR(EINVAL);
         }
 
-- 
2.45.2

_______________________________________________
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] 5+ messages in thread

* [FFmpeg-devel] [PATCH 4/4] avfilter/af_pan: check nb_output_channels before use
  2024-06-11 13:44 [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure Michael Niedermayer
  2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 2/4] avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds Michael Niedermayer
  2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 3/4] avfilter/af_mcompand: compute half frequency in double Michael Niedermayer
@ 2024-06-11 13:44 ` Michael Niedermayer
  2024-07-07 20:13 ` [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure Michael Niedermayer
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-06-11 13:44 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Fixes: CID1500281 Out-of-bounds write
Fixes: CID1500331 Out-of-bounds write

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavfilter/af_pan.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavfilter/af_pan.c b/libavfilter/af_pan.c
index 31c6be45c37..da32977c995 100644
--- a/libavfilter/af_pan.c
+++ b/libavfilter/af_pan.c
@@ -119,6 +119,14 @@ static av_cold int init(AVFilterContext *ctx)
     if (ret < 0)
         goto fail;
 
+    if (pan->nb_output_channels > MAX_CHANNELS) {
+        av_log(ctx, AV_LOG_ERROR,
+               "af_pan supports a maximum of %d channels. "
+               "Feel free to ask for a higher limit.\n", MAX_CHANNELS);
+        ret = AVERROR_PATCHWELCOME;
+        goto fail;
+    }
+
     /* parse channel specifications */
     while ((arg = arg0 = av_strtok(NULL, "|", &tokenizer))) {
         int used_in_ch[MAX_CHANNELS] = {0};
-- 
2.45.2

_______________________________________________
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] 5+ messages in thread

* Re: [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure
  2024-06-11 13:44 [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure Michael Niedermayer
                   ` (2 preceding siblings ...)
  2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 4/4] avfilter/af_pan: check nb_output_channels before use Michael Niedermayer
@ 2024-07-07 20:13 ` Michael Niedermayer
  3 siblings, 0 replies; 5+ messages in thread
From: Michael Niedermayer @ 2024-07-07 20:13 UTC (permalink / raw)
  To: FFmpeg development discussions and patches


[-- Attachment #1.1: Type: text/plain, Size: 531 bytes --]

On Tue, Jun 11, 2024 at 03:44:19PM +0200, Michael Niedermayer wrote:
> Fixes: CID1503078 Resource leak
> 
> Sponsored-by: Sovereign Tech Fund
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavfilter/af_aresample.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

will apply patchset

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you think the mosad wants you dead since a long time then you are either
wrong or dead since a long time.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

[-- Attachment #2: Type: text/plain, Size: 251 bytes --]

_______________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2024-07-07 20:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-11 13:44 [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure Michael Niedermayer
2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 2/4] avfilter/af_channelsplit: Assert that av_channel_layout_channel_from_index() succeeds Michael Niedermayer
2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 3/4] avfilter/af_mcompand: compute half frequency in double Michael Niedermayer
2024-06-11 13:44 ` [FFmpeg-devel] [PATCH 4/4] avfilter/af_pan: check nb_output_channels before use Michael Niedermayer
2024-07-07 20:13 ` [FFmpeg-devel] [PATCH 1/4] avfilter/af_aresample: Cleanup on av_channel_layout_copy() failure Michael Niedermayer

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