mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2026-06-24 08:48:37 +00:00
libswresample: Prevent out of bounds.
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:151.
To prevent error we need to fix checks for in and out fmt in swr_init.
Signed-off-by: Eli Kobrin <kobrineli@ispras.ru>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 3e97d96e6f)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
280ceef4f9
commit
057a7e36e8
@@ -155,11 +155,11 @@ av_cold int swr_init(struct SwrContext *s){
|
||||
|
||||
clear_context(s);
|
||||
|
||||
if(s-> in_sample_fmt >= AV_SAMPLE_FMT_NB){
|
||||
if((unsigned) s-> in_sample_fmt >= AV_SAMPLE_FMT_NB){
|
||||
av_log(s, AV_LOG_ERROR, "Requested input sample format %d is invalid\n", s->in_sample_fmt);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
if(s->out_sample_fmt >= AV_SAMPLE_FMT_NB){
|
||||
if((unsigned) s->out_sample_fmt >= AV_SAMPLE_FMT_NB){
|
||||
av_log(s, AV_LOG_ERROR, "Requested output sample format %d is invalid\n", s->out_sample_fmt);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user