From patchwork Sat Sep 22 16:14:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 10448 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:1286:0:0:0:0:0 with SMTP id 6-v6csp718871jap; Sat, 22 Sep 2018 09:16:38 -0700 (PDT) X-Google-Smtp-Source: ACcGV61Rw20mBbm+BdbBL7rASomxBGyRJN9fWOGF3aN+O+F4zEEVkdvaBnQ1r5gG+KAfHpgGGT59 X-Received: by 2002:a1c:f611:: with SMTP id w17-v6mr2046530wmc.143.1537632998015; Sat, 22 Sep 2018 09:16:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537632997; cv=none; d=google.com; s=arc-20160816; b=tEUW6/U1CFKvuLqV7BE2Ka9lw4yiuZsemWiYMpHJWI7q2krM9jdodapB25RtZaDSRl cuNuyiIbkIy6KaaE4tvDM542N85aFA9485JPWpljjTpkbzeB+udnra2BLShukqKpaVrI VquBolDSiEDokmq/AkGrfmiDWvCjZ9xGNibNWJIW5xhjW6ETx68i+l2aSZP4qdsUSS0v ZK2YJ24Taz0wTLDOToIY1S4onnQh3pJsgNd8YxUC2755cISPBLm5m6K0TYtQE4wPmuc/ TcEtzzx3S+4SCTfip4vz2tB7cQL01gAcgYX0dXJuL12PFp0IY3ZVbSZ0GX0PyeL8vNzF KbUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=HVC13fsmohM5o1+vln7czuLCcNdvuX297BsB2u6yg0c=; b=BEI7+imNoeCrkl+gjHxr+RSu8AtJYU7Yw81BH67P0EuMXXpozEilWmu31hGPU6acOy EZTNZRHEQYqlwjFA+1X84F++oH/C4Vz+XlrM2Jl6e4UmExHen4m068R3TYyXX0Gk/32u uU8pWVLNA1QWi8KOUYcVuLS1OGT6J6gb1Bnz9m/sva9LSXoUgt3ZaW/kIJmoT/0rsVO5 BkyLK8a0G0xVN4lrWpmmm+WZFbqWc5WkQsKnXUBcb4UbsYOdLys+Hp177zsPSkcbxyZi /EhovJY+R4djpOBOG+HAUPvmxHdaIeGGH7lZEK2pVGm+8ATRn3JW7g+Sb+XAMi47VWIQ qpCg== 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 h18-v6si10473503wrr.20.2018.09.22.09.16.37; Sat, 22 Sep 2018 09:16:37 -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 8126E68A6C6; Sat, 22 Sep 2018 19:15:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe08-2.mx.upcmail.net (vie01a-dmta-pe08-2.mx.upcmail.net [84.116.36.21]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3CC5B68A636 for ; Sat, 22 Sep 2018 19:15:01 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe08.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1g3kYu-0001Cz-Kq for ffmpeg-devel@ffmpeg.org; Sat, 22 Sep 2018 18:15:16 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id egF61y00f0S5wYM01gF7gy; Sat, 22 Sep 2018 18:15:07 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sat, 22 Sep 2018 18:14:07 +0200 Message-Id: <20180922161408.22052-11-michael@niedermayer.cc> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180922161408.22052-1-michael@niedermayer.cc> References: <20180922161408.22052-1-michael@niedermayer.cc> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/11] avcodec/prosumer: Check remaining space in put byte context 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: Timeout Fixes: 10053/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PROSUMER_fuzzer-5636993883570176 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/prosumer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/prosumer.c b/libavcodec/prosumer.c index 2420dd5f12..6e98677b55 100644 --- a/libavcodec/prosumer.c +++ b/libavcodec/prosumer.c @@ -57,6 +57,8 @@ static int decompress(GetByteContext *gb, int size, PutByteContext *pb, const ui b = lut[2 * idx]; while (1) { + if (bytestream2_get_bytes_left_p(pb) <= 0) + return 0; if (((b & 0xFF00u) != 0x8000u) || (b & 0xFFu)) { if ((b & 0xFF00u) != 0x8000u) { bytestream2_put_le16(pb, b);