From patchwork Mon Aug 20 21:29:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 10044 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp2982069jap; Mon, 20 Aug 2018 14:29:25 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwJTJjroFoUUX4eKOsQ/OwFzXtcA1kuPdXy1Wlw4/VwRVLaiO71BdUuNp/K9vpKL+E9RmN+ X-Received: by 2002:a1c:55c2:: with SMTP id j185-v6mr27486210wmb.104.1534800565452; Mon, 20 Aug 2018 14:29:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534800565; cv=none; d=google.com; s=arc-20160816; b=iUEK/zcH56kMVR59g7f4Mi2uX8wPOdSHNot8OdO2pZn9GZHrR7YDTsbUkK1600hBBt n+Tjt5ILPcXhQwGpkpOGiRgaFJZZ5INITgxi9P8Sd+QsR6ZL/U2TBwf5lPfVvR3e4xYo s25imV0SZLL8PeHPDnYuk23wmI30e8eWtGhWGyIkTnzmXBshzcOpnh+CoErUVftM/a2e Ct9EIxsF/dWukEAaCBIq6/oTp90foTbzap15DIBQ9tnCCNs9NReNh0xgommI0vPSigKE UF1wI/QXdUxVtmZoulrwLTgPkW/YeM9GyZ6yLeO2Dkz0XkoswDDZ02ewaODuVKpLxU2T 9Ztg== 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=4fr7J1xUMtaYeWbAVA2Gn6zeQ3dv8w96CrTCSleBPXM=; b=v9th8wgkCR9crYEmKMY5hYKSpo0/Tv677aRWIdjb64WWOKmr3nrwIQ0Jvcdcjc2Z6c 0eyYtX/NNF+gL0WUlrL6f3xVFhryyvIfxbf3pR8HQ6AYa12WHdboACX9sm0NLtt1IoEX xxlA2HKjP6fgzQmMyMwaM32zu6X7IgxO6liqYbJNellKMv/8MmcYCVKh76S242ozpJU0 NFObqbSHVJC5yAAmzrbDzYMGnrFIxa5GsolZzMBvw2Da4Jc6DPhT0F8PdMFTBhtdwEj/ CYV7l8szk1MS2fnhYM4kFam1Xi2eijuPIzDOGXlSvh36L3ogXe2wejp+0M14n/pYc84N E0uA== 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 v1-v6si1395445wru.385.2018.08.20.14.29.25; Mon, 20 Aug 2018 14:29:25 -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 A5440689CC8; Tue, 21 Aug 2018 00:28:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe06-3.mx.upcmail.net (vie01a-dmta-pe06-3.mx.upcmail.net [84.116.36.16]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EE4E8689B43 for ; Tue, 21 Aug 2018 00:28:50 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe06.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1frrjh-0006Ju-He for ffmpeg-devel@ffmpeg.org; Mon, 20 Aug 2018 23:29:17 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id RZVB1y00P0S5wYM01ZVCxT; Mon, 20 Aug 2018 23:29:12 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 20 Aug 2018 23:29:01 +0200 Message-Id: <20180820212901.15317-3-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180820212901.15317-1-michael@niedermayer.cc> References: <20180820212901.15317-1-michael@niedermayer.cc> Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/hq_hqa: Check remaining input bits in hqa_decode_mb() 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: Timeout Fixes: 9634/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_HQ_HQA_fuzzer-6267852259590144 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/hq_hqa.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c index f88ad7d5f5..ec9da3e04f 100644 --- a/libavcodec/hq_hqa.c +++ b/libavcodec/hq_hqa.c @@ -181,6 +181,9 @@ static int hqa_decode_mb(HQContext *c, AVFrame *pic, int qgroup, int flag = 0; int i, ret, cbp; + if (get_bits_left(gb) < 1) + return AVERROR_INVALIDDATA; + cbp = get_vlc2(gb, c->hqa_cbp_vlc.table, 5, 1); for (i = 0; i < 12; i++)