[FFmpeg-cvslog] avformat/avs: Check if return code is representable

Michael Niedermayer git at videolan.org
Thu Oct 19 14:32:08 EEST 2023


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Wed Sep 20 01:32:56 2023 +0200| [2265582b3ae8f25d43ef77b3e0c42aac33d42897] | committer: Michael Niedermayer

avformat/avs: Check if return code is representable

Fixes: leak
Fixes: 62164/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-6738814988320768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 52d666edec73c834c60811e330f86a7cf1d916da)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/avs.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/avs.c b/libavformat/avs.c
index d1811ab1e0..e6984fe411 100644
--- a/libavformat/avs.c
+++ b/libavformat/avs.c
@@ -135,6 +135,10 @@ static int avs_read_audio_packet(AVFormatContext * s, AVPacket * pkt)
         return 0;    /* this indicate EOS */
     if (ret < 0)
         return ret;
+    if (size != (int)size) {
+        av_packet_unref(pkt);
+        return AVERROR(EDOM);
+    }
 
     pkt->stream_index = avs->st_audio->index;
     pkt->flags |= AV_PKT_FLAG_KEY;



More information about the ffmpeg-cvslog mailing list