From patchwork Mon Jul 2 00:10:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 9565 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:104:0:0:0:0:0 with SMTP id c4-v6csp3258111jad; Sun, 1 Jul 2018 17:11:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfCX0exdusO7mP9Sm9Py74kXXBqGlm6/i/W4RJlJLU/L2r2UbAvFexGqZAEZE81B3ez4spb X-Received: by 2002:a1c:6d41:: with SMTP id i62-v6mr6516044wmc.25.1530490311313; Sun, 01 Jul 2018 17:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530490311; cv=none; d=google.com; s=arc-20160816; b=mlfcyeE+EPozVtbRq/SUTzJTnfEPQJZ47UBADsCSUY5S+ETITc5p+gSqSHATGKbkWK nh4GK9iDuqx0Cz32sWKDxA/VjFGFhYXhTk0l4cEHrg5P/H/upiTPtnMwxPxirQcYoT09 tWpGQpllVNCxTa+17TMhj2i4C/thgM/HCMTQZLddySVbgTx+COUAqlbBDKIToZSaS/uj 1NJWpR6ZngXm99Ex/9lRtWPDhvAD8j2Sp8uPCaKjtenm7WngS9dD1TPUNemcRLXvysfs BkdEkc1idJqb52mkfDJFE2XOxCYEBtzznrjaRImhCNfreIPIhSaqf+DjTeDo3MId2kjI 5cHQ== 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=3xsVV4MIYEbw9XSFkmtSA9kZEFAoDoXxyQVgqSJw1Jk=; b=qopYqNhhUo2YNJ8o+lDykF+pjU9YC6dfAK8+x2r1ilm/CbRHrlsXg6cdxAWBchfbTv 20Zc+p+XzsKPH/yuT5y9dxlA2F5xDd1VnkVXkWJVq76/5WC8N9EBABoirI2myfAfvAxi 3+utUhIddmH5q57K4DCFd9jzJjQNC9cIIHICb4/tiuKEYcuN/lK5rKwVCwJ2o3oWM7NK yvriuVUd6kTkLL0TM2LNIUw4s+DkLmpUmcEiaCc2OH7y10wI7BmKVyXFdrd2eAlHQfig iloEMNHm77s4HXanUU/0DIivtCQaX+pHWETQz18DGGf+S0nc8E0yiGuESS5PM6VsKX7v NHrA== 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 m1-v6si3607847wrr.254.2018.07.01.17.11.50; Sun, 01 Jul 2018 17:11:51 -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 9F7D3688366; Mon, 2 Jul 2018 03:11:45 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-1.mx.upcmail.net (vie01a-dmta-pe07-1.mx.upcmail.net [84.116.36.17]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4FD14680625 for ; Mon, 2 Jul 2018 03:11:39 +0300 (EEST) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1fZmRS-000796-4i for ffmpeg-devel@ffmpeg.org; Mon, 02 Jul 2018 02:11:42 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 5cBZ1y01F0S5wYM01cBadk; Mon, 02 Jul 2018 02:11:35 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 2 Jul 2018 02:10:44 +0200 Message-Id: <20180702001045.29491-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.18.0 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/truemotion2: Check len in tm2_read_stream() 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: 8774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEMOTION2_fuzzer-5942199639343104 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg --- libavcodec/truemotion2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index b689efdb99..58a577f53c 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -377,6 +377,10 @@ static int tm2_read_stream(TM2Context *ctx, const uint8_t *buf, int stream_id, i } } } else { + if (len < 0) { + ret = AVERROR_INVALIDDATA; + goto end; + } for (i = 0; i < toks; i++) { ctx->tokens[stream_id][i] = codes.recode[0]; if (stream_id <= TM2_MOT && ctx->tokens[stream_id][i] >= TM2_DELTAS) {