From patchwork Tue Jul 3 21:05:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9600 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp58707jad; Tue, 3 Jul 2018 14:06:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdbblmzQ7xrNtwzYwMoMdjljvS1HRplcHm2Z23QUrUD4MvfafBirEcKZwZ6r/bC/TBsGveH X-Received: by 2002:a1c:2482:: with SMTP id k124-v6mr364175wmk.87.1530652018873; Tue, 03 Jul 2018 14:06:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530652018; cv=none; d=google.com; s=arc-20160816; b=x6pDd+iF6+YLHnzvLSuECT50MF8u7R0GrhmIhrFewwWDI2u4gMewOcWQG3sdOh9jaZ ThUvs81iB0/rv5zNVvZuDfK1hM8Qm/K6K2KO3j25L5HnXxTqlfD/iG69VvTQ07MlFsg+ 2wswns02xenrN5AWMZqP+0e9AuLBW9pXQJ/jfQmncnaL6q5OX+e+nZ1pfUchErrS0E2G qyhAA/cLmhG+uRDheldpNnr+fHi/tDd42pc7A3HOl9MhCS/6RJ0IOd5Cm/NJJgknSULj E6+aG6vjIcVlWLPWQXOgvUOI8Rk33G4b6x790BI+YyT7kMNWZv++pXiG6lMap2NQHBGD jvgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:delivered-to:arc-authentication-results; bh=vmOGleQyM6xNdx8zDax/ktb7zM7R5nViyQ91gBF3+TU=; b=spRwu7wAiZ+tPlXVgbFlsX4HjphMIaTbqPK0qYRJcN3vNfpXDIfcaIaoF1BUA2Z8vz 0VPCux2oNA1K6yGxW4lxZdVrhj9IyTZhnQw5REgpdS3wBfYIrzfS9pfOoTnd63AgJ8PP wI1ijGCNb/6HJZ6d0GRUUnt4HNenXWe/Y35Vv5KBK1EmhF3hEBp0rYs5Bb/3OGnXWqlt 6SGWV35HOL3oEFj05fN6Ke1IhNfcMCCa/iME8b0rPXUuG7Xn+X/j+oM9xRpQqQQDcVqT AySx/haJqYdwJBHiqsw9WqcqGh/y7IBn1mRWGoDS6b1L2ebFkeGjW4DozKKbZ9T6LubG SECg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id t1-v6si1457727wrq.111.2018.07.03.14.06.58; Tue, 03 Jul 2018 14:06:58 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8EC4568A969; Wed, 4 Jul 2018 00:06:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe05-2.mx.upcmail.net (vie01a-dmta-pe05-2.mx.upcmail.net [84.116.36.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4C60468A94F for ; Wed, 4 Jul 2018 00:06:28 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe05.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1faSVM-0006Zr-4k for ffmpeg-devel@ffmpeg.org; Tue, 03 Jul 2018 23:06:32 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 6M6N1y02N0S5wYM01M6QzP; Tue, 03 Jul 2018 23:06:24 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 3 Jul 2018 23:05:27 +0200 Message-Id: <20180703210530.7493-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180703210530.7493-1-michael@niedermayer.cc> References: <20180703210530.7493-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/6] avformat/asfdec_o: Check size_bmp more fully 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: integer overflow and out of array access Fixes: asfo-crash-46080c4341572a7137a162331af77f6ded45cbd7 Found-by: Paul Ch Signed-off-by: Michael Niedermayer --- libavformat/asfdec_o.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/asfdec_o.c b/libavformat/asfdec_o.c index 5122e33c78..b4b2698368 100644 --- a/libavformat/asfdec_o.c +++ b/libavformat/asfdec_o.c @@ -706,7 +706,8 @@ static int parse_video_info(AVIOContext *pb, AVStream *st) st->codecpar->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag); size_bmp = FFMAX(size_asf, size_bmp); - if (size_bmp > BMP_HEADER_SIZE) { + if (size_bmp > BMP_HEADER_SIZE && + size_bmp < INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) { int ret; st->codecpar->extradata_size = size_bmp - BMP_HEADER_SIZE; if (!(st->codecpar->extradata = av_malloc(st->codecpar->extradata_size +