[FFmpeg-devel] [PATCH] Fix for possible buffer overflow.
Michael Niedermayer
michael at niedermayer.cc
Thu Jan 6 11:05:51 EET 2022
On Wed, Jan 05, 2022 at 04:26:09PM -0800, AlexisWilke wrote:
> If it is true that the (index + c) can be larger than s->limiter_buf_size
> then the overflow potential has to be handled in the previous two statements.
>
> Signed-off-by: AlexisWilke <alexis at m2osw.com>
> ---
> libavfilter/af_loudnorm.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/libavfilter/af_loudnorm.c b/libavfilter/af_loudnorm.c
> index dbe7fba986..9e6a830a56 100644
> --- a/libavfilter/af_loudnorm.c
> +++ b/libavfilter/af_loudnorm.c
> @@ -206,10 +206,11 @@ static void detect_peak(LoudNormContext *s, int offset, int nb_samples, int chan
> continue;
>
> for (c = 0; c < channels; c++) {
> - if (c == 0 || fabs(buf[index + c]) > max_peak)
> - max_peak = fabs(buf[index + c]);
> + int idx((index + c) < s->limiter_buf_size ? (index + c) : (index + c - s->limiter_buf_size));
which compiler did build this successfully ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220106/b823ee4a/attachment.sig>
More information about the ffmpeg-devel
mailing list