[FFmpeg-cvslog] avformat/mov: prevent potential use of uninitialized value

Martijn van Beurden git at videolan.org
Tue Jul 5 15:13:19 EEST 2022


ffmpeg | branch: master | Martijn van Beurden <mvanb1 at gmail.com> | Sat Jun 11 09:32:16 2022 +0200| [c8d839df73196a9a5a03b75a12467e6e33d306f7] | committer: Paul B Mahol

avformat/mov: prevent potential use of uninitialized value

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 88669faa70..5d8b24368a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6797,7 +6797,10 @@ static int mov_read_dfla(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     avio_rb24(pb); /* Flags */
 
-    avio_read(pb, buf, sizeof(buf));
+    if (avio_read(pb, buf, sizeof(buf)) != sizeof(buf)) {
+        av_log(c->fc, AV_LOG_ERROR, "failed to read FLAC metadata block header\n");
+        return pb->error < 0 ? pb->error : AVERROR_INVALIDDATA;
+    }
     flac_parse_block_header(buf, &last, &type, &size);
 
     if (type != FLAC_METADATA_TYPE_STREAMINFO || size != FLAC_STREAMINFO_SIZE) {



More information about the ffmpeg-cvslog mailing list