diff mbox series

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

Message ID 20220604103507.1822192-2-mvanb1@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel,v2,1/2] avformat/cafdec: Implement FLAC-in-CAF parsing | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_armv7_RPi4 success Make finished
andriy/make_fate_armv7_RPi4 success Make fate finished

Commit Message

Martijn van Beurden June 4, 2022, 10:35 a.m. UTC
---
 libavformat/mov.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index d7be593a86..f3a63abaaa 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 AVERROR_INVALIDDATA;
+    }
     flac_parse_block_header(buf, &last, &type, &size);
 
     if (type != FLAC_METADATA_TYPE_STREAMINFO || size != FLAC_STREAMINFO_SIZE) {