From patchwork Thu Oct 5 19:44:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 44161 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:7a24:b0:15d:8365:d4b8 with SMTP id t36csp256917pzh; Thu, 5 Oct 2023 12:44:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEKIgBBdC6gx9izcslAMrwOlSy5jkTfHLaYXDbsEGkpFkkN1Pr9T7gn6eqtBdyOv2RuNlRT X-Received: by 2002:a17:906:3051:b0:9a5:7759:19c0 with SMTP id d17-20020a170906305100b009a5775919c0mr5728214ejd.64.1696535094315; Thu, 05 Oct 2023 12:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696535094; cv=none; d=google.com; s=arc-20160816; b=XvppnI35prabpxrF5mWEf6cZfWp43j0HnuCgvcICSaiO9LysJJsU380ukoqL4yKjfA N3YhJRq+pbJFhLKupVQFB9CkpP/N1DyUCPMr7iIWZascUR8zy83u/ISuiP0gLb6TCqgN 5iuH0uy/CgE24wA9mI0WZdPcrXimwHuiiiqJ5gA33CP/e1PKg4YCtdLSqsqfgVaSdeaj 8S+h1s/rHl4FyWLNe0V+mdO6GUdicGob6cjWWEA5bbgsoF5Tg7jgUB+D9yEy0DLBH+YR 28KNwuzGYEDMB3e62oygrvevLiEDrM4dzI8Ye5Ht57QCs6fl+HTtZO7Wt08KanQBsvk2 a8zA== 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; bh=03eoOUz+TwHl+ilHYmgbelcFt1j5GHYSprGBD5xTWwY=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=JbgrdmUCT41wf2BrC1xxPgp4f3Sd/NyJ6uYF7EpjH38ctFE9KBqGnpDIKV8wGvu+Ru 4PJul/icct/vhSNFWyLXjIcRmfWJR+8Mm3CcycZpoUPoj8/lQPJbXFdNQw5n8rOVeJe5 hg7hnwq3fG3YzdwkQmKJI56dKqp3fJ3to7eclFOhcnUji2nOKGAiEZ0lNVcQ1mivUizK d+aIWEztSVkSOWs2oJlvuZguNKep3l0n98Sbq+BeEgQx+akcglgXFVSx5ZkL/QahKQGl c4K2FOCERuSeELD/0aPamfGILEnlX6+YIBG3zruEK25eypLAVY58I98oB+QVuXFHo4Nc HiNg== 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 r8-20020a170906364800b0099bd8e4b30esi944018ejb.996.2023.10.05.12.44.53; Thu, 05 Oct 2023 12:44:54 -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 71C3D68CA0E; Thu, 5 Oct 2023 22:44:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8850168C9A2 for ; Thu, 5 Oct 2023 22:44:42 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id E58F71C0005 for ; Thu, 5 Oct 2023 19:44:40 +0000 (UTC) From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Thu, 5 Oct 2023 21:44:36 +0200 Message-Id: <20231005194440.1678-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.17.1 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 1/5] avcodec/bonk: Fix undefined overflow in predictor_calc_error() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: Gke0IFmLA2MN Fixes: signed integer overflow: -2146469728 - 1488954 cannot be represented in type 'int' Fixes: 62490/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_BONK_fuzzer-5612782399389696 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/bonk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bonk.c b/libavcodec/bonk.c index 6cd6a0af619..65679e5fb65 100644 --- a/libavcodec/bonk.c +++ b/libavcodec/bonk.c @@ -270,7 +270,7 @@ static inline int shift(int a, int b) static int predictor_calc_error(int *k, int *state, int order, int error) { - int i, x = error - shift_down(k[order-1] * (unsigned)state[order-1], LATTICE_SHIFT); + int i, x = error - (unsigned)shift_down(k[order-1] * (unsigned)state[order-1], LATTICE_SHIFT); int *k_ptr = &(k[order-2]), *state_ptr = &(state[order-2]);