mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 21:00:41 +08:00
avfilter/avf_showcqt: fix unbounded index when copying to fft_data
When timeclamp and/or fps are low, j can be negative.
Fix Ticket11640
(cherry picked from commit 35ea458354)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
9b9b22993f
commit
8577a6b2fe
@@ -1519,7 +1519,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];
|
||||
}
|
||||
@@ -1548,7 +1548,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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user