diff mbox series

[FFmpeg-devel,1/3] avformat/cafdec: clip sample rate

Message ID 20201118210818.8111-1-michael@niedermayer.cc
State Accepted
Commit 684aec6a6872c9e3bb0afee1979f1cd3edd1f8ce
Headers show
Series [FFmpeg-devel,1/3] avformat/cafdec: clip sample rate | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Nov. 18, 2020, 9:08 p.m. UTC
Fixes: 1.21126e+111 is outside the range of representable values of type 'int'
Fixes: 27398/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-5412960339755008

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/cafdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Dec. 24, 2020, 2:25 p.m. UTC | #1
On Wed, Nov 18, 2020 at 10:08:16PM +0100, Michael Niedermayer wrote:
> Fixes: 1.21126e+111 is outside the range of representable values of type 'int'
> Fixes: 27398/clusterfuzz-testcase-minimized-ffmpeg_dem_CAF_fuzzer-5412960339755008
> 
> Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/cafdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply patchset

[...]
diff mbox series

Patch

diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 3bf1fa64bc..ec297dfa7d 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -70,7 +70,7 @@  static int read_desc_chunk(AVFormatContext *s)
 
     /* parse format description */
     st->codecpar->codec_type  = AVMEDIA_TYPE_AUDIO;
-    st->codecpar->sample_rate = av_int2double(avio_rb64(pb));
+    st->codecpar->sample_rate = av_clipd(av_int2double(avio_rb64(pb)), 0, INT_MAX);
     st->codecpar->codec_tag   = avio_rl32(pb);
     flags = avio_rb32(pb);
     caf->bytes_per_packet  = avio_rb32(pb);