]> git.sesse.net Git - ffmpeg/commitdiff
avformat/cafdec: clip sample rate
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 17 Nov 2020 23:48:26 +0000 (00:48 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 24 Dec 2020 14:25:00 +0000 (15:25 +0100)
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

index c188aad20f698dd67f0865423ebba2a6a75e2103..b7a9711cc596082783a5c6107af794fd61f88d42 100644 (file)
@@ -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);