From c8d839df73196a9a5a03b75a12467e6e33d306f7 Mon Sep 17 00:00:00 2001 From: Martijn van Beurden Date: Sat, 11 Jun 2022 09:32:16 +0200 Subject: [PATCH] avformat/mov: prevent potential use of uninitialized value --- 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) {