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