From patchwork Fri Sep 18 22:26:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 22480 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 49E70449D1E for ; Sat, 19 Sep 2020 01:33:08 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 26A6968B7D0; Sat, 19 Sep 2020 01:33:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-2.mx.upcmail.net (vie01a-dmta-pe06-2.mx.upcmail.net [84.116.36.15]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F2F3568B7C5 for ; Sat, 19 Sep 2020 01:33:01 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.92) (envelope-from ) id 1kJOqv-0006Ee-07 for ffmpeg-devel@ffmpeg.org; Sat, 19 Sep 2020 00:27:37 +0200 Received: from localhost ([213.47.68.29]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id JOpwkJIwWIr7GJOpxkaR0p; Sat, 19 Sep 2020 00:26:37 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.68.29 X-CNFS-Analysis: v=2.3 cv=QN4WuTDL c=1 sm=1 tr=0 a=2hcxjKEKjp0CzLx6oWAm4g==:117 a=2hcxjKEKjp0CzLx6oWAm4g==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=T1ohQcsuM_a4z6vljxkA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 19 Sep 2020 00:26:36 +0200 Message-Id: <20200918222636.31899-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-CMAE-Envelope: MS4wfOiDW7uRlybEDthwThfCzXhqyZgHsIrEFpqeRHkT46t20vPnxG9VoXV07Vz/n+OFh+fYjEAGPBpgARhdNVLKuEBr7LrXrURCWwf2g7Dr7Bs03ny4J62A k9DcAuxxTD/fiUoNjjbHA/wIu6HQbzgm8KsDCIhjkMoas2kNtiTSh7Sf Subject: [FFmpeg-devel] [PATCH] avformat/3dostr: Check remaining buffer in probe before 8 byte step X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: segfault Fixes: signal_sigabrt_7ffff6ae7cc9_7213_0d6457b9d6897fa7c78507fa5de53510.ts Regression since: 3ac45bf66561a667260cac37223c0393f7333fca Signed-off-by: Michael Niedermayer --- libavformat/3dostr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/3dostr.c b/libavformat/3dostr.c index 2d92b46570..2a35d661c3 100644 --- a/libavformat/3dostr.c +++ b/libavformat/3dostr.c @@ -29,10 +29,9 @@ static int threedostr_probe(const AVProbeData *p) unsigned chunk = AV_RL32(p->buf + i); unsigned size = AV_RB32(p->buf + i + 4); - i += 8; if (size < 8 || p->buf_size - i < size) return 0; - + i += 8; size -= 8; switch (chunk) { case MKTAG('C','T','R','L'):