aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Kobrin <kobrineli@ispras.ru>2023-08-02 15:14:10 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2023-08-02 17:31:13 +0200
commit3e97d96e6f239894317fc6eb778b25ce67ce5451 (patch)
treec34bc43a363649b6c9ce3696f92d9f28eb92eb4a
parent0e9956a06e9307e01232bc354665fadf6f7a09df (diff)
downloadffmpeg-3e97d96e6f239894317fc6eb778b25ce67ce5451.tar.gz
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>
-rw-r--r--libswresample/swresample.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 6dc329a9d0..fb3d7bccbf 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -196,11 +196,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);
}