From: kobrineli <kobrineli@ispras.ru>
To: ffmpeg-devel@ffmpeg.org
Cc: Eli Kobrin <kobrineli@ispras.ru>
Subject: [FFmpeg-devel] [PATCH] libswresample: Prevent out of bounds.
Date: Wed, 2 Aug 2023 12:35:24 +0300
Message-ID: <20230802093524.1136658-1-kobrineli@ispras.ru> (raw)
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;
--
2.25.1
_______________________________________________
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".
next reply other threads:[~2023-08-02 9:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-02 9:35 kobrineli [this message]
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
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=20230802093524.1136658-1-kobrineli@ispras.ru \
--to=kobrineli@ispras.ru \
--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