From patchwork Sun Jan 28 01:29:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7431 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp2379671jak; Sat, 27 Jan 2018 17:29:20 -0800 (PST) X-Google-Smtp-Source: AH8x2261N/G6XR/IvXJK3fqu/ikt6Zp7pDfXuXK8n9EQtAjF+PUT9r1GfubWQIplxaAf/qFEswp0 X-Received: by 10.223.160.55 with SMTP id k52mr15308736wrk.5.1517102960433; Sat, 27 Jan 2018 17:29:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517102960; cv=none; d=google.com; s=arc-20160816; b=yFgz1c0uYdj3E3hvcrdi0q+TXFU5Py0ToPgX0iTV/aAwdX5IdzAnjTe5QsLtpi9Z75 fdv0svS7QK8Ip09AmTCRX2/M4DFIIGqQXk0DNTq6IinpLuhSRW5KB6TW8oGXu8JOj5+k DxXV2sNeP7Jbq0vKB2y9t+rQ3EeQqzY5wLeHKmlTzELUHS/y/0EyC9XXSvhbaoOvwKyD cVA65Trd4AiU35CWvlzmL819zAbxnI51NG89M/8OFawkInidTPETYb9MMBg+CPWfP718 e/PdwgeYfGE1MMhNVHyRnBEtyU3R+0QUfwGFcI+w8IpuVazADhgaxaWsttyBrzIilyso MCMg== 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:message-id:date:to:from:delivered-to :arc-authentication-results; bh=U3boM164YOt64wVVxentavAuYq/3NOoOyh5vwSZZIKw=; b=wAYR+4rVHisaklYpypcFVPhlFrVFaayt7LFyWeu4ErZduq0+dfE/etDIjvgYlgxTi1 WI4gDpR2GyWfpIIcREClRpdwU1r0N3WFBVr8Y7bVrS7O+3P2jviGRDDbNqseyvhaBzY+ ikKapkyWP2/Jq4Iy5d+8xojTr7LQpOOTgDpZ2GgyLZvfsau8RQTFZ6EzNFlMbH+uu0xu wMJpu689FD0JpL6b90C3zn+Y9aS5NhI/yIWpnln+beSxZ6rMxNZO+PyYxdGk8FoIEpCF 3kTRrjIz7EOfGXZS14eT1NC+HA/REYqnAamBCm9tOaduCRjnCFlXEn3z5d9XoQeMsUyr gkIQ== 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 e131si3455248wmg.188.2018.01.27.17.29.19; Sat, 27 Jan 2018 17:29:20 -0800 (PST) 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 8B7EC680489; Sun, 28 Jan 2018 03:29:14 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-1.mx.upcmail.net (vie01a-qmta-pe02-1.mx.upcmail.net [62.179.121.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3DF306803CE for ; Sun, 28 Jan 2018 03:29:08 +0200 (EET) Received: from [172.31.218.34] (helo=vie01a-dmta-pe02-1.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1efbmR-00047V-Jf for ffmpeg-devel@ffmpeg.org; Sun, 28 Jan 2018 02:29:11 +0100 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1efbmL-0001vq-Lk for ffmpeg-devel@ffmpeg.org; Sun, 28 Jan 2018 02:29:05 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 3dV31x00Z0S5wYM01dV4Lc; Sun, 28 Jan 2018 02:29:04 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 28 Jan 2018 02:29:00 +0100 Message-Id: <20180128012902.22504-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.16.1 Subject: [FFmpeg-devel] [PATCH 1/3] avcodec/mpeg4videodec: Check mb_num also against 0 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" The spec implies that 0 is invalid in addition to the existing checks Found-by: Signed-off-by: Michael Niedermayer --- libavcodec/mpeg4videodec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 12755b5e8a..ba332de531 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -465,7 +465,7 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx) } mb_num = get_bits(&s->gb, mb_num_bits); - if (mb_num >= s->mb_num) { + if (mb_num >= s->mb_num || !mb_num) { av_log(s->avctx, AV_LOG_ERROR, "illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num); return -1;