From patchwork Sun Oct 14 17:56:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 10672 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 BEDBA446E21 for ; Sun, 14 Oct 2018 21:01:13 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 208D868A199; Sun, 14 Oct 2018 21:00:55 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-1.mx.upcmail.net (vie01a-dmta-pe06-1.mx.upcmail.net [84.116.36.14]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 753D5680CCC for ; Sun, 14 Oct 2018 21:00:49 +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.88) (envelope-from ) id 1gBkhV-0002NF-0W for ffmpeg-devel@ffmpeg.org; Sun, 14 Oct 2018 20:01:13 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id BkgXgqvsTkosQBkgXg49sF; Sun, 14 Oct 2018 20:00:13 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.41.20 X-CNFS-Analysis: v=2.3 cv=NNQEBHyg c=1 sm=1 tr=0 a=I1eytVlZLDX1BM2VTtTtSw==:117 a=I1eytVlZLDX1BM2VTtTtSw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=pGLkceISAAAA:8 a=0hxJpFhkR5o8uii0tjoA:9 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 14 Oct 2018 19:56:56 +0200 Message-Id: <20181014175656.27005-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfINgYM/ZDucZvhFzTU+/F3rnVRvqM/S2bUvWYz2U4aj4MRbpR7Qd1fwgcSSH9VePbiBm/BYNsq8fI7u9KXRjmg5p5dysW+/xPgbCBWJhj02RQGRTxR3f Bd6PvELSosyAMdmhvi8squGc/E3+VafohOKRO7nvriJdKVN4KsJZMufZ Subject: [FFmpeg-devel] [PATCH] avcodec/av1_parse: Check obu_size 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Fixes: out of array read Fixes: SIGSEGV_get_obu_bit_length_av1_parse Found-by: keval shah Signed-off-by: Michael Niedermayer --- libavcodec/av1_parse.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/av1_parse.h b/libavcodec/av1_parse.h index 276af33ba9..864308f81d 100644 --- a/libavcodec/av1_parse.h +++ b/libavcodec/av1_parse.h @@ -134,8 +134,8 @@ static inline int parse_obu_header(const uint8_t *buf, int buf_size, size = *obu_size + *start_pos; - if (size > INT_MAX) - return AVERROR(ERANGE); + if (size > buf_size) + return AVERROR_INVALIDDATA; return size; }