Message ID | 20240720005241.726089-7-michael@niedermayer.cc |
---|---|
State | New |
Headers | show
Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:a742:0:b0:482:c625:d099 with SMTP id f2csp899663vqm; Fri, 19 Jul 2024 18:11:51 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV5diwszpmGkYy/QebQPdtbFhxeuNlijqZON41nd2DuZapgIgqFzo0hgKiXX0eRNSoio8yROPt03rJvz0vQ7s8lN0/XrZo1+k0Bkg== X-Google-Smtp-Source: AGHT+IH5obG4zN8qdKBdjWgT85ofr+oRcsJOC4N+ZqrsTKIMnuME1gL4VaxDY63/P3BIT1SsvC0r X-Received: by 2002:adf:a181:0:b0:362:7c2e:e9f7 with SMTP id ffacd0b85a97d-369bae48cacmr76768f8f.32.1721437911563; Fri, 19 Jul 2024 18:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1721437911; cv=none; d=google.com; s=arc-20160816; b=tEjCkx3QoIcraZ2cVOXEX4d4ScXGnKhMcYXdNq1mktZulnNzzY6tdzi/x9huxzpxd4 /app9QWMDnGPdAmRXVccAyIErvYxnV4PK5t+Yg0cmsDgXUxkPPVzYROFM6BlMQ6Qm10S bpgfrOy4NNMuibxIMwgFpgoyixQl0Ba849yJkHOflhmwWTp7qB3wj0C9wXjV3LXjhQUH 6YWnJY1bHGB7wmTtPEKHqZokc9Is9WoI+mrPpvhpa7KxxAQIsUvOLXVL3AbWtwXdbCEQ ehYAmvpuJJSg+pHH3qPjhw5PmMZ5UtlWMpE/beTdrUIZUxWXcIuzitzsoI77MKG0gHre WtWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=hBFcEl/t9iY+IsTlkXFPTV1yAHJ9JKxKO4uxyTVCSug=; fh=e5zN9xSzcxLA6bGo3lF+CqTbY/oLwzApV03EO/RBfgQ=; b=zj/FIpVBAPfNa92M2jAz3rYQA8BoCKG63k0JRTP2CjlYcnU2VHPme0kseqKtMA1UVa tLrKC6B4ONw9XEqL/R4Xf9c4OF/gIk0a6uja5Am3uLPnUj5mlziqzMPNBb4ZPlv4DS99 79CBi0S0DnFRM1ev9YSdlQSQHRFF4btOXotNeVpVhEIRLuVvHrG6j5Z/tlbynGFnzIZM 7wBRuYdmL0JrF2DQLoXvkaFDCAqRP2OMbG5hnYX7oUEFEUbtEp6zudIgGxxvpkMpJFVB c3v9Mfvd4UXTWB706rBn9Hbyp0iElTBNt05rnSbumDb1xn1h+6BPlIbriDNOMEwO2ja3 LKkA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=Z7ILEfSy; 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: <ffmpeg-devel-bounces@ffmpeg.org> Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a7a3c99057fsi84036266b.967.2024.07.19.18.11.51; Fri, 19 Jul 2024 18: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; dkim=neutral (body hash did not verify) header.i=@niedermayer.cc header.s=gm1 header.b=Z7ILEfSy; 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 ECEC768DA1B; Sat, 20 Jul 2024 03:52:59 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E1FC468D863 for <ffmpeg-devel@ffmpeg.org>; Sat, 20 Jul 2024 03:52:48 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 2FCCDC0004 for <ffmpeg-devel@ffmpeg.org>; Sat, 20 Jul 2024 00:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1721436768; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TeTL7tWx7MipFRtGJvdT/uKgcA2XLzS1C+zB5ALm28Q=; b=Z7ILEfSyIAXV4Wd031VlftYe2ZlrDZdk/w+tRAVqH5pjXzBur9I0mTEnsKvnMXXlW5BJXw EGLhsCbSBU5PD5GvZqcnaXQ3PCG0Oc2SFXWVol0yQrUILSqmY494pY6ynJd/WhC+YZYUSS WZkJ1nskohVEahRCoTYKiz13Fg3JT8bwSptdSkWQFJTszJsW0MND130wO9qrcopOLDsO0H mHhU55F+3CmckAHHbeke8RKxmNdUinne09uz3ReWW3POefx5qJDp0ZCwA4g9KAzvRaZj6O 5zh2rhmARX7q+2k2fOR/FJEvsadb3lLCCMvzoTqHFV8P6rJv91j0obM8zXlvTQ== From: Michael Niedermayer <michael@niedermayer.cc> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Date: Sat, 20 Jul 2024 02:52:37 +0200 Message-ID: <20240720005241.726089-7-michael@niedermayer.cc> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240720005241.726089-1-michael@niedermayer.cc> References: <20240720005241.726089-1-michael@niedermayer.cc> MIME-Version: 1.0 X-GND-Sasl: michael@niedermayer.cc Subject: [FFmpeg-devel] [PATCH 07/11] avcodec/osq: avoid using too large numbers for shifts and integers in update_residue_parameter() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches <ffmpeg-devel.ffmpeg.org> List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe> List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel> List-Post: <mailto:ffmpeg-devel@ffmpeg.org> List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help> List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>, <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe> Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org> X-TUID: F4XrgJLspSoO |
Series |
[FFmpeg-devel,01/11] avcodec/alsdec: Clear shift_value
|
expand
|
diff --git a/libavcodec/osq.c b/libavcodec/osq.c index 1bd4485f074..42a46b25ce5 100644 --- a/libavcodec/osq.c +++ b/libavcodec/osq.c @@ -161,11 +161,15 @@ static int update_residue_parameter(OSQChannel *cb) sum = cb->sum; x = sum / cb->count; - rice_k = av_ceil_log2(x); + rice_k = ceil(log2(x)); if (rice_k >= 30) { - rice_k = floor(sum / 1.4426952 + 0.5); - if (rice_k < 1) + double f = floor(sum / 1.4426952 + 0.5); + if (f <= 1) { rice_k = 1; + } else if (f >= 31) { + rice_k = 31; + } else + rice_k = f; } return rice_k;
Fixes: 2.96539e+09 is outside the range of representable values of type 'int' Fixes: Assertion n>=0 && n<=32 failed at libavcodec/get_bits.h:423 Fixes: 62241/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-4525761925873664 Fixes: 70406/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_OSQ_fuzzer-6545326804434944 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> --- libavcodec/osq.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)