diff mbox series

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

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

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 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 11, 2022, 7:32 a.m. UTC
---
 libavformat/mov.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Paul B Mahol June 11, 2022, 8:50 a.m. UTC | #1
lgtm
diff mbox series

Patch

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) {