[FFmpeg-cvslog] avformat/pcm: Check block_align

Michael Niedermayer git at videolan.org
Sun Oct 25 11:03:55 EET 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Oct 20 21:44:32 2020 +0200| [b23a619c132a8ad5282a5fd02bfe8b253101c79d] | committer: Michael Niedermayer

avformat/pcm: Check block_align

Fixes: signed integer overflow: 321 * 8746632 cannot be represented in type 'int'
Fixes: 26461/clusterfuzz-testcase-minimized-ffmpeg_dem_PVF_fuzzer-6326427831762944

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b23a619c132a8ad5282a5fd02bfe8b253101c79d
---

 libavformat/pcm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/pcm.c b/libavformat/pcm.c
index 767bbd045a..1effc0b6f8 100644
--- a/libavformat/pcm.c
+++ b/libavformat/pcm.c
@@ -39,7 +39,11 @@ int ff_pcm_read_packet(AVFormatContext *s, AVPacket *pkt)
      * Clamp to RAW_SAMPLES if larger.
      */
     size = FFMAX(par->sample_rate/25, 1);
-    size = FFMIN(size, RAW_SAMPLES) * par->block_align;
+    if (par->block_align <= INT_MAX / RAW_SAMPLES) {
+        size = FFMIN(size, RAW_SAMPLES) * par->block_align;
+    } else {
+        size = par->block_align;
+    }
 
     ret = av_get_packet(s->pb, pkt, size);
 



More information about the ffmpeg-cvslog mailing list