Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: kobrineli@ispras.ru
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Cc: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Subject: Re: [FFmpeg-devel] [PATCH] libswresample: Prevent out of bounds.
Date: Wed, 02 Aug 2023 14:42:36 +0300
Message-ID: <40e6dcd181d27b7660b8bd62cc1a0818@ispras.ru> (raw)
In-Reply-To: <GV1P250MB0737A7C62D29753617D1315C8F0BA@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM>

Resubmitted the patch 
(https://patchwork.ffmpeg.org/project/ffmpeg/patch/20230802113106.1138555-1-kobrineli@ispras.ru/).
Didn't understand how to fix the existing patch.

On 2023-08-02 13:51, Andreas Rheinhardt wrote:
> kobrineli:
>> From: Eli Kobrin <kobrineli@ispras.ru>
>> 
>> We've been fuzzing torchvision with 
>> [sydr-fuzz](https://github.com/ispras/oss-sydr-fuzz)
>> and found out of bounds error in ffmpeg project at audioconvert.c:51.
>> To prevent error we need to insert corresponding check.
>> 
>> Signed-off-by: Eli Kobrin <kobrineli@ispras.ru>
>> ---
>>  libswresample/audioconvert.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/libswresample/audioconvert.c 
>> b/libswresample/audioconvert.c
>> index 1d75ba1495..701f4808a0 100644
>> --- a/libswresample/audioconvert.c
>> +++ b/libswresample/audioconvert.c
>> @@ -148,7 +148,12 @@ AudioConvert *swri_audio_convert_alloc(enum 
>> AVSampleFormat out_fmt,
>>                                         int flags)
>>  {
>>      AudioConvert *ctx;
>> -    conv_func_type *f = 
>> fmt_pair_to_conv_functions[av_get_packed_sample_fmt(out_fmt) + 
>> AV_SAMPLE_FMT_NB*av_get_packed_sample_fmt(in_fmt)];
>> +
>> +    size_t idx = av_get_packed_sample_fmt(out_fmt) + AV_SAMPLE_FMT_NB 
>> * av_get_packed_sample_fmt(in_fmt);
>> +    if (idx >= AV_SAMPLE_FMT_NB * AV_SAMPLE_FMT_NB)
>> +        return NULL;
>> +
>> +    conv_func_type *f = fmt_pair_to_conv_functions[idx];
>> 
>>      if (!f)
>>          return NULL;
> 
> Something seems to be using an invalid sample format (either out_fmt or
> in_fmt). You should investigate where this comes from.
> (Given that this is a public function, we should probably validate user
> input; and maybe stop using AV_SAMPLE_FMT_NB altogether.)
> 
> - Andreas
> 
> _______________________________________________
> 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".
_______________________________________________
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".

  parent reply	other threads:[~2023-08-02 11:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-02  9:35 kobrineli
2023-08-02 10:51 ` Andreas Rheinhardt
2023-08-02 11:15   ` kobrineli
2023-08-02 11:19   ` kobrineli
2023-08-02 11:42   ` kobrineli [this message]
2023-08-02 11:31 kobrineli
2023-08-02 12:06 ` Ronald S. Bultje
2023-08-02 12:14   ` kobrineli
2023-08-02 12:14 kobrineli
2023-08-02 15:37 ` Michael Niedermayer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40e6dcd181d27b7660b8bd62cc1a0818@ispras.ru \
    --to=kobrineli@ispras.ru \
    --cc=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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