From patchwork Thu Sep 6 09:15:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 10249 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp255416jap; Thu, 6 Sep 2018 02:15:43 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda1UmXXmiueQey3V9D5xTQL2qN5xYdLUYVLNM3ALbRPGN8ow7CeaMEj2fxmvc9P2dPZkELV X-Received: by 2002:a1c:864c:: with SMTP id i73-v6mr1615250wmd.40.1536225343784; Thu, 06 Sep 2018 02:15:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536225343; cv=none; d=google.com; s=arc-20160816; b=h3tnGq7rZ+HamVQaplnuAa091XSCsSdg6qlDCKR9xkL5FsOek1HKiF+VKo54nI8rHC X3QCZKlsCIKHvaYxsdMnARQQyNrIEuM/xvFoprCm7Kpc8ja3LAD7xPZHMkCQ7J+Y34jK bNO3zQw2AyJsQnB/+cfrY+UkGQhwRn2kbuejQCwOo+5bIlgrF2NnwIHRltrrlfKhu1ba Z23dRitcxuS22dm9vwthV2BwABL0eay+CU+nxoVj33JCIID7IMuHpHp2Wm/0nSvqSOvy v6qoGiX1NFhalJ6qcZdyatfVAjgZzLOhp/i0gpzNkdJyHgv/qGZHzToK+PBphZFasGnU AQ9w== 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:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:message-id:date:to:from :dkim-signature:delivered-to; bh=mbcv+EqpINxWKI9xy9JlvHZ0Wfb7kQhOJBuxfmhkKhA=; b=rOynj1cBZFSE3qvDsK17QOAJ6Tj93jbRM91hnB6fl7iz11Dor4h/UtlTcy8VYllip/ umQJDLn0m6FJe9Q3nLmkN5laJOq7RXjMwnT/zIMP1XPE7o5Khn5QdzCKJwF4ufEWULi+ KFn8xYaf/YwcXkCGWLfR07O3lTcB2zL/nsMB/Xe1oTCuuZOuyG1GKygtzzbgF9YZHdVx SdSFPFgVkc+7AzVQRtpTAcuVhK7/MD0KkE6cYuTpqNxYUwp7mgyfDHEtZLbB2YzMDUDr OIvn51rlKFonnWNff3PhwRiO/k1CMRoKkPC29vFfdI59hR5njYfSzwV+xtoIwQU9J6OH utWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=Vrb+47yq; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d7-v6si4292233wrv.239.2018.09.06.02.15.43; Thu, 06 Sep 2018 02:15:43 -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; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=Vrb+47yq; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 20A91689EBB; Thu, 6 Sep 2018 12:15:34 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg65.qq.com (smtpbg65.qq.com [103.7.28.233]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 867AF688243 for ; Thu, 6 Sep 2018 12:15:25 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1536225328; bh=GaDyaTi1tkhGQ0H8JGnuPjKDOcu5YqBZBo5lIBSkG64=; h=From:To:Cc:Subject:Date:Message-Id; b=Vrb+47yqO1ocYBr43hRQXBZqEXZMoNsCjRkZ/v5ccyTEEeYGOoBY8NFsFBnW/oLZd PuATiSux+xDundzBd47kLBCS8Mxjf5rd0loEdCufzZX0x8u/sbWWOkcGXn9JJFsXlF G0rSdgEcAXIp9a9IZFsoVVUgrUf7TSTPQMqEhUP0= X-QQ-mid: esmtp3t1536225327t6pm3og8n Received: from localhost.localdomain (unknown [223.26.106.80]) by esmtp4.qq.com (ESMTP) with id ; Thu, 06 Sep 2018 17:15:14 +0800 (CST) X-QQ-SSF: A1000000000000F0F91100000000001 X-QQ-FEAT: uUcGM8V09o7y/wU80+gCDDmHQGV/mHZp43Fa47e/hUN4QPLI5SlLm3bzShRbQ nNHYfcyWmIMyZTGog90SuN/DI056LnSAJ6UMvYk1QLhwrILOwn0BDYkRGl4xyJT5OiY4+ql yCmckXuxgv0MvcZXAca2rHnyrUeR9Qx5XjvjhxARE/hUny19EAgImtAg40G3iTRU1+WVpsa rE3e3JwmQbr5qKI24zZ5sJG8VFT9uJnMxX89TDYHYlBOTkoZKXQPvvGVxR/JBaTqzeZhmND NSuCt+KugKBSymXAcWPYRdkEo= X-QQ-GoodBg: 0 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Thu, 6 Sep 2018 17:15:11 +0800 Message-Id: <20180906091511.4868-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.9.5 X-QQ-SENDSIZE: 520 Feedback-ID: esmtp:foxmail.com:bgforeign:bgforeign2 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] avcodec/h264dec: check number of SPS in is_extra 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 Cc: Zhao Zhili MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/h264dec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index bffce52..6f7530d 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -871,6 +871,8 @@ static int is_extra(const uint8_t *buf, int buf_size) { int cnt= buf[5]&0x1f; const uint8_t *p= buf+6; + if (!cnt) + return 0; while(cnt--){ int nalsize= AV_RB16(p) + 2; if(nalsize > buf_size - (p-buf) || (p[2] & 0x9F) != 7)