From patchwork Fri Jun 22 00:38:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9477 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:141:0:0:0:0:0 with SMTP id c62-v6csp269530jad; Thu, 21 Jun 2018 17:39:00 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL7SZXxoDzHjADHw9E5aw6OknN/XOeMZu1qLhaZ+azkMxaAoNxnsyHRAiayzh0qj0Tlr7OO X-Received: by 2002:a1c:7204:: with SMTP id n4-v6mr6505067wmc.138.1529627940154; Thu, 21 Jun 2018 17:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529627940; cv=none; d=google.com; s=arc-20160816; b=DHDg0blILA8245oHoVljQa4j9X3h0iELs8529lDug9cYJdtVBya7feRM3tWTALzkTl Vzep++mj7X9LyQh//pA2b3aBk3WAYgcEAbFj0jUxCFE0EJH7kXWSBDLvY8pxL3lbPlvu MGOTK0WD8D2ytzBt6UUey7aQMBIV4706ZMzLj2qJU6X7XrtPRUrG6mWBWJ0zbDZjZd6o xR7HCc6kyT+JQ2qkHvfXx+O/GSXioNKU3FmIVkSEHPp76qS7oqYnZ6jGFQoXKPYfYot/ Gas+FOZ4wCAk9gp5VR8DxtUt9eTLAD6jyB0D/wlK2cPV9lVugNsBcwcZoTCKeVdY8Nsv g+dg== 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=Em6bNhSZT00eBt6wFwl4U67jTrWD4rJNqnFpVmn2wj4=; b=efliQ/djKzVV843mmsqcxT5sPa/G8E4F8L6fU7TQGwib23osxI5rwSG/mf6qRUzP4J Wq2wLykTJubiy5it6O4Xlvp3JM61roFUmmzn8I0ic8wnXkHY4pyDTbyzw8fWOcdOPYdM xmBU0zULAy2y7PucAgHjs3XGaRiHCFIX5zzBMTbajx5Rk2rqiI639dd+OqAWNXbNcECk mIKflA9rWhWvKC3UX6hfi0eWtNyBjKi0Klw8u8s+k8U7z/7t4IoHiTctkf6vXDxK0eBF wi2Q+ES6TEK1627TSNRY8KIhOh6xQcHY4riBHTk11pweRYA6Xr7TJaAOrkqNFc3FYtpp vAlw== 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 k66-v6si342727wmg.126.2018.06.21.17.38.59; Thu, 21 Jun 2018 17:39:00 -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 40AFD68A7AC; Fri, 22 Jun 2018 03:38:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-qmta-pe02-3.mx.upcmail.net (vie01a-qmta-pe02-3.mx.upcmail.net [62.179.121.183]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B796868A6E7 for ; Fri, 22 Jun 2018 03:37:57 +0300 (EEST) Received: from [172.31.218.41] (helo=vie01a-dmta-pe04-2.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fWA6F-0008L6-9h for ffmpeg-devel@ffmpeg.org; Fri, 22 Jun 2018 02:38:51 +0200 Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe04.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fWA69-0006lj-7x for ffmpeg-devel@ffmpeg.org; Fri, 22 Jun 2018 02:38:45 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 1cee1y0240S5wYM01cegRV; Fri, 22 Jun 2018 02:38:40 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Fri, 22 Jun 2018 02:38:02 +0200 Message-Id: <20180622003802.31249-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 Subject: [FFmpeg-devel] [PATCH] avcodec/cscd: Check output buffer size for lzo. 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: 8665/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CSCD_fuzzer-5768442610188288 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg --- libavcodec/cscd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c index 35c4ee08c3..5eb511a565 100644 --- a/libavcodec/cscd.c +++ b/libavcodec/cscd.c @@ -81,7 +81,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, switch ((buf[0] >> 1) & 7) { case 0: { // lzo compression int outlen = c->decomp_size, inlen = buf_size - 2; - if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen)) { + if (av_lzo1x_decode(c->decomp_buf, &outlen, &buf[2], &inlen) || outlen) { av_log(avctx, AV_LOG_ERROR, "error during lzo decompression\n"); return AVERROR_INVALIDDATA; }