From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 84C1F42337 for ; Sat, 12 Mar 2022 23:52:53 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A18A668B160; Sun, 13 Mar 2022 01:52:50 +0200 (EET) Received: from vie01a-dmta-at03-1.mx.upcmail.net (unknown [62.179.121.151]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5B5F68A962 for ; Sun, 13 Mar 2022 01:52:43 +0200 (EET) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-at03.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1nTBXP-000381-7g for ffmpeg-devel@ffmpeg.org; Sun, 13 Mar 2022 00:52:43 +0100 Received: from ren-mail-psmtp-mg02. ([80.109.253.241]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id TBXPnKlDNSgGFTBXPn2xa6; Sun, 13 Mar 2022 00:52:43 +0100 Received: from localhost ([213.47.68.29]) by ren-mail-psmtp-mg02. with ESMTP id TBXAnzGJJfYHNTBXAnB3cD; Sun, 13 Mar 2022 00:52:28 +0100 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.4 cv=MrIxV0We c=1 sm=1 tr=0 ts=622d324a a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=5qjNtTWC_UPmtnd7hHMA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 13 Mar 2022 00:52:26 +0100 Message-Id: <20220312235227.19626-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220312235227.19626-1-michael@niedermayer.cc> References: <20220312235227.19626-1-michael@niedermayer.cc> X-CMAE-Envelope: MS4wfMXMANKZN/18BqNkPr4h6xE4t/RP0uRj7iado39SO6jljDuiBYYP8jlS+XuuKPJO+LXlDCK93xfmtG9NhdjXhSjYUK1Sn2FTjDZXHXikthYGibj1nIUy GKwDKQ/z/UkUg+9bfEjAuahTQ/BljWBjfZrMBgZt5MYhB8KC7hQ5g70ZxKYu4U2Cdb80+Grb4WIsRg== Subject: [FFmpeg-devel] [PATCH 3/4] avformat/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Signed-off-by: Michael Niedermayer --- libavformat/mxfdec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index d7cdd22c8a..828fc0f9f1 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -932,6 +932,7 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count) { + int64_t ret; unsigned c = avio_rb32(pb); //avio_read() used int @@ -946,7 +947,12 @@ static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count) return AVERROR(ENOMEM); } avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ - avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID)); + ret = avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID)); + if (ret != *count * sizeof(UID)) { + *count = ret < 0 ? 0 : ret / sizeof(UID); + return ret < 0 ? ret : AVERROR_INVALIDDATA; + } + return 0; } -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".