From patchwork Tue May 21 00:22:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 13215 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 8EFF4447B13 for ; Tue, 21 May 2019 03:29:10 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 66D3468A7A7; Tue, 21 May 2019 03:29:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe07-3.mx.upcmail.net (vie01a-dmta-pe07-3.mx.upcmail.net [84.116.36.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5B47689E21 for ; Tue, 21 May 2019 03:29:04 +0300 (EEST) Received: from [172.31.216.235] (helo=vie01a-pemc-psmtp-pe12.mail.upcmail.net) by vie01a-dmta-pe07.mx.upcmail.net with esmtp (Exim 4.91) (envelope-from ) id 1hSsYl-0006TN-2x for ffmpeg-devel@ffmpeg.org; Tue, 21 May 2019 02:23:15 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe12.mail.upcmail.net with ESMTP id SsXmhvww95D5NSsXnhwwYt; Tue, 21 May 2019 02:22:15 +0200 X-Env-Mailfrom: michael@niedermayer.cc X-Env-Rcptto: ffmpeg-devel@ffmpeg.org X-SourceIP: 213.47.41.20 X-CNFS-Analysis: v=2.3 cv=bu8y+3Si c=1 sm=1 tr=0 a=I1eytVlZLDX1BM2VTtTtSw==:117 a=I1eytVlZLDX1BM2VTtTtSw==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=GEAsPZ9sns4A:10 a=ZZnuYtJkoWoA:10 a=nZOtpAppAAAA:20 a=C8qjyFwMC1rv0hvoiAQA:9 a=1fhp2MxaeJtTNGEnv6mo:22 a=pHzHmUro8NiASowvMSCR:22 a=xoEH_sTeL_Rfw54TyV31:22 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Tue, 21 May 2019 02:22:10 +0200 Message-Id: <20190521002210.932-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CMAE-Envelope: MS4wfOxnYOEdxouSfxUO/+Tl+IcvK4lYvqxiixmX70EVbu5vMYnN/+z6YZBa0FYK8TxPvOjNRb2M0Zx+PaohBY7tr7tFAPVoSM8fb5D8LM+zS/zTqhLl8ud+ 5mGTJYcyWTsQLHvsUtVrhe6DMOV0shEm3JTijVwqAyBNSaRdgiHdmDrm Subject: [FFmpeg-devel] [PATCH] avcodec/dxv: Check op_offset in dxv_decompress_cocg() 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: signed integer overflow: -2147483648 - 12 cannot be represented in type 'int' Fixes: 14732/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DXV_fuzzer-5735273129836544 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dxv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index 6fe5516505..5fd1844094 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -745,6 +745,9 @@ static int dxv_decompress_cocg(DXVContext *ctx, GetByteContext *gb, int skip0, skip1, oi0 = 0, oi1 = 0; int ret, state0 = 0, state1 = 0; + if (op_offset < 12) + return AVERROR_INVALIDDATA; + dst = tex_data; bytestream2_skip(gb, op_offset - 12); if (op_size0 > max_op_size0)