From patchwork Wed Jan 3 22:42:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 7106 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.79.195 with SMTP id r64csp16441886jad; Wed, 3 Jan 2018 14:43:04 -0800 (PST) X-Google-Smtp-Source: ACJfBovcH0LFh6wbHFi4s+8NU6WTIqT80SebRJOmLbry0FG19iEd/teutlXNtfPTw4kjZ7tk+D0R X-Received: by 10.223.195.46 with SMTP id n43mr3087990wrf.212.1515019383986; Wed, 03 Jan 2018 14:43:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515019383; cv=none; d=google.com; s=arc-20160816; b=y4hMKtVbRf0QUSYTX3qaTZue+JhfJRYkATKkKf26ld4UTxO+2w7Y0Uy+BxIT9Hpr/v wSWU9wyPntYwcSkVOui+hcpqm/5uM9P04pcZVW5q6zCRH3dPbrnvGA2fsdRXsNvQG+IP udvHMRZaOPY3IfPgbjGhXUWVttHSzhuhCrQEDP01ZB7g960oygkrOwRYdiHZ7asge/eG e9T4wWLM+Zl+MOjc1mtm3AaDZDCmBidruKM7uu54NGF/kJYETJb98AeTYjfF6RhNec86 wQ94ByvIgQAJtZ9mLAfyRav0RfZ4TYtZPzCAA8RhzFOAlb9E8v8ir/GI+/lBPG5Zaov8 4Scg== 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=nPKDaT68vWRUe/1cQFsJY1p9qcNRx8QGlFAs52OBbFQ=; b=UpkhrVFdZ3KjD0/JIvjaX+iTYTyayaQTqcZPKIbGlP5Q5b27hHkJEN5tj+gF+8H8/B qmyCK1kTOUkFo5iOIKmQzqZ8BrqAOhJknqFAucwAsI+Sii2L0pEUcAWS1Wf+1yfjJ4JL 2Y3ECbMeKB38b528x064ZILEsO+Kp/6qBNXE53+Z7fLsEkAbpt0nS24I708xTr8Latat mfO4TagSHhs7lJ4Dv3Q56GygiHErow2eJPzv8fdp6cL3UBE9xJ+nrDxf9VDJnJ9LZUqD PXoQL7zHPDbzBH6xX7zARtkYqvaKMXp03xTqPvLY8RC57AWs75NS+GzwiV+dXbGq7DV/ LTnA== 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 c21si1475189wrb.352.2018.01.03.14.43.03; Wed, 03 Jan 2018 14:43:03 -0800 (PST) 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 6CAE968988E; Thu, 4 Jan 2018 00:42:02 +0200 (EET) 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 2E3F968834A for ; Thu, 4 Jan 2018 00:41:56 +0200 (EET) Received: from [172.31.218.52] (helo=vie01a-dmta-pe08-1.mx.upcmail.net) by vie01a-pqmta-pe02.mx.upcmail.net with esmtp (Exim 4.88) (envelope-from ) id 1eWrjg-0000eL-I5 for ffmpeg-devel@ffmpeg.org; Wed, 03 Jan 2018 23:42:12 +0100 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 1eWrja-0005oQ-Os for ffmpeg-devel@ffmpeg.org; Wed, 03 Jan 2018 23:42:06 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id tyi21w00s0S5wYM01yi3td; Wed, 03 Jan 2018 23:42:03 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Wed, 3 Jan 2018 23:42:00 +0100 Message-Id: <20180103224201.18317-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.15.1 Subject: [FFmpeg-devel] [PATCH 1/2] avcodec/dnxhddec: Check dc vlc 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: signed integer overflow: 1024 + 2147483640 cannot be represented in type 'int' Fixes: 4671/clusterfuzz-testcase-minimized-6027464343027712 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dnxhddec.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 05f4458f99..11d0bf424a 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -383,6 +383,10 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx, UPDATE_CACHE(bs, &row->gb); GET_VLC(len, bs, &row->gb, ctx->dc_vlc.table, DNXHD_DC_VLC_BITS, 1); + if (len < 0) { + ret = len; + goto error; + } if (len) { level = GET_CACHE(bs, &row->gb); LAST_SKIP_BITS(bs, &row->gb, len); @@ -436,7 +440,7 @@ static av_always_inline int dnxhd_decode_dct_block(const DNXHDContext *ctx, GET_VLC(index1, bs, &row->gb, ctx->ac_vlc.table, DNXHD_VLC_BITS, 2); } - +error: CLOSE_READER(bs, &row->gb); return ret; }