[FFmpeg-devel] [PATCH v3 2/2] avformat/mov: prevent potential use of uninitialized value

Martijn van Beurden mvanb1 at gmail.com
Sat Jun 11 10:32:16 EEST 2022


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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d7be593a86..51c0f6f9d8 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -6772,7 +6772,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) {
-- 
2.30.2



More information about the ffmpeg-devel mailing list