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] avfilter/avf_showcqt: fix unbounded index when copying to fft_data
@ 2025-07-03 13:47 Muhammad Faiz
  2025-08-07 23:23 ` Muhammad Faiz
  0 siblings, 1 reply; 2+ messages in thread
From: Muhammad Faiz @ 2025-07-03 13:47 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: Muhammad Faiz

When timeclamp and/or fps are low, j can be negative.

Fix Ticket11640
---
 libavfilter/avf_showcqt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
index 8ff6ecb..8f9b782 100644
--- a/libavfilter/avf_showcqt.c
+++ b/libavfilter/avf_showcqt.c
@@ -1515,7 +1515,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
         i = insamples->nb_samples - remaining;
         j = s->fft_len/2 + s->remaining_fill_max - s->remaining_fill;
         if (remaining >= s->remaining_fill) {
-            for (m = 0; m < s->remaining_fill; m++) {
+            for (m = FFMAX(0, -j); m < s->remaining_fill; m++) {
                 s->fft_data[j+m].re = audio_data[2*(i+m)];
                 s->fft_data[j+m].im = audio_data[2*(i+m)+1];
             }
@@ -1544,7 +1544,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *insamples)
                 s->fft_data[m] = s->fft_data[m+step];
             s->remaining_fill = step;
         } else {
-            for (m = 0; m < remaining; m++) {
+            for (m = FFMAX(0, -j); m < remaining; m++) {
                 s->fft_data[j+m].re = audio_data[2*(i+m)];
                 s->fft_data[j+m].im = audio_data[2*(i+m)+1];
             }
-- 
2.43.0

_______________________________________________
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] avfilter/avf_showcqt: fix unbounded index when copying to fft_data
  2025-07-03 13:47 [FFmpeg-devel] [PATCH] avfilter/avf_showcqt: fix unbounded index when copying to fft_data Muhammad Faiz
@ 2025-08-07 23:23 ` Muhammad Faiz
  0 siblings, 0 replies; 2+ messages in thread
From: Muhammad Faiz @ 2025-08-07 23:23 UTC (permalink / raw)
  To: ffmpeg-devel

On Thu, Jul 3, 2025 at 8:48 PM Muhammad Faiz <mfcc64@gmail.com> wrote:

> When timeclamp and/or fps are low, j can be negative.
>
> Fix Ticket11640
> ---
>  libavfilter/avf_showcqt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/libavfilter/avf_showcqt.c b/libavfilter/avf_showcqt.c
> index 8ff6ecb..8f9b782 100644
> --- a/libavfilter/avf_showcqt.c
> +++ b/libavfilter/avf_showcqt.c
> @@ -1515,7 +1515,7 @@ static int filter_frame(AVFilterLink *inlink,
> AVFrame *insamples)
>          i = insamples->nb_samples - remaining;
>          j = s->fft_len/2 + s->remaining_fill_max - s->remaining_fill;
>          if (remaining >= s->remaining_fill) {
> -            for (m = 0; m < s->remaining_fill; m++) {
> +            for (m = FFMAX(0, -j); m < s->remaining_fill; m++) {
>                  s->fft_data[j+m].re = audio_data[2*(i+m)];
>                  s->fft_data[j+m].im = audio_data[2*(i+m)+1];
>              }
> @@ -1544,7 +1544,7 @@ static int filter_frame(AVFilterLink *inlink,
> AVFrame *insamples)
>                  s->fft_data[m] = s->fft_data[m+step];
>              s->remaining_fill = step;
>          } else {
> -            for (m = 0; m < remaining; m++) {
> +            for (m = FFMAX(0, -j); m < remaining; m++) {
>                  s->fft_data[j+m].re = audio_data[2*(i+m)];
>                  s->fft_data[j+m].im = audio_data[2*(i+m)+1];
>              }
> --
> 2.43.0
>
>
Ping
_______________________________________________
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:[~2025-08-07 23:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-03 13:47 [FFmpeg-devel] [PATCH] avfilter/avf_showcqt: fix unbounded index when copying to fft_data Muhammad Faiz
2025-08-07 23:23 ` Muhammad Faiz

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