Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w3LYi-0018M8-06 for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 22:09:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w3LYg-003EtV-1W for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Mar 2026 22:09:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w3LYg-003EtN-04 for pgsql-hackers@lists.postgresql.org; Thu, 19 Mar 2026 22:09:38 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1w3LYd-000000004u2-2xxZ for pgsql-hackers@postgresql.org; Thu, 19 Mar 2026 22:09:38 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-439d8df7620so824766f8f.0 for ; Thu, 19 Mar 2026 15:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1773958175; cv=none; d=google.com; s=arc-20240605; b=aA7Sdv4ZON+HQu7p+vp9hVlKbsben2PmS8tQcLMB1mHoMsJ16KfoUqr4fierCWd8d5 djONRUAhkGOGT0bknstorEmQHo4bmW4Yf0pNep6Hro7ZVIABAZlMuxfvTbqbfDfKbA2a GzsRSsxWScu4ZEA4je9gQjqzLj6Vl8/c5AL9MsALLHis7WzZhWRAmdLY8WLWYOPKXSvX g4DRv2mno4Vp18AO74tD0yphzUzmq7hOc1aRRovoZI6cxOnsIu09fP0WL9aiS+LfiM6a 9m8KQbCqrIDRjrAz6YIehfIBnMi/ZdZ5AriFdft4VJLRB265W5Pe9ODehaYoPXsMiK5s ZQ7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=DDzXUlksJl3MzjCJWfAGre1DGMlEN94sVnNffa2MmXk=; fh=SKkYwvw8VyG45pdeqIrwwrngpt/dfue+pH86QEOSOsM=; b=H8Rnkkop1ggHSeXGdtZASk93OcJyBo3YtQmEkrpwq+dOylAnsOVcElGReZOuhNHK5G h0Z6etzInZzbxO1vBwOFTw4bFroUhB8uYl2t+AM0ONhfiF1S9oJ8uLuXfHbF3heJ/yfU D/YgUyOL0b9U9cZK8gfdNX3FByXSPqvLUzz9c/ng0O1BA0x53o466ZsMA8BMlB6emPDX q2pk+MPjcGZnJ/OqOYufzuYjE3xjSwD0+0ljcQQxmgZgP55ge2vZ+h4x8Yxt+Y51Vyk5 8Df9OZ3Egv2llE2Arei95EAbJacEMJVTXSIyfp9Mrxg8dChSvJErrda4ucCQCwd2K+1G IJNw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20230601.gappssmtp.com; s=20230601; t=1773958175; x=1774562975; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DDzXUlksJl3MzjCJWfAGre1DGMlEN94sVnNffa2MmXk=; b=bTHQ1h2sjZPugx+BKBv79fpxo/nOwxylUmEei8/S0xDbbHhNeid2YLc40RJX8+Y/Xa qIB7TyBrSdeaKshxZ6pof6lfDnmwoGEygXbC3pdMTVxp5dRIzRRFIHESvR1xw7f31ZxD y9R3oi3ABIoMBRI5x4XGowfIuRdCUbOHLzedQZLPJ/VZ/FxJ/hvAxA3DKimsKcTiZ2L8 OiAc5DRW3FmI0RrSQzBZfHPtrRUGuqERPu8h4K9xhQfdzkmU6ISDMdI7M5LDBI3yovT+ QccJJ8NQDwk3Av4fOQ/hSiutV367uCrSyBZwOlhU7osOh8DCLqotiT0uXXCFpIaM1BSf Qs5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773958175; x=1774562975; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=DDzXUlksJl3MzjCJWfAGre1DGMlEN94sVnNffa2MmXk=; b=PbGEE1F1sUSSqP0L4wqd4Az3sCLuff3sXLBTiRjI/Kj8PVhyAkBc2lsQkEj+neWLCc qXWdNoX/ZwW/GZAJFE8d5/ProvoclDOX4COraxeShzl2PG3jwghq6vexzyIjFuDFoULy gJ4oqH1HfaANvXVcvRwLDiZp5DzmX70FfBnlTHZSgphcdlkGA7jPnPgs+TR9J3NFhg8x vxYMEpkleyfEcyFLhVVUCta4Wl6sGFZsobH+sgW9N5COaL+HAc3m2qcCQqco8CgPrST6 EozDCwWwALNWC7ISeCdu7sCntubq0jpWb8c1qbbibL4FrCcoRMgAlDUFFWE5kTVIf6S1 MV9g== X-Gm-Message-State: AOJu0YyHYAbjatW3oDPWt4J15ncYuXSBx/+zTkzfd3M0MeDY7mvba70I yipK9m5CX1cEbCJkGGhbcfWgeZmd0xd2FuBSUM8+kVUFg3RFpN9FFZysmUwhaWmeyYTnVMxCo2P mRAxzcb2Dy4cKdDgTI5SEAh37ZH4vYhOQaloX4rsya5TACBvRjlol4jc= X-Gm-Gg: ATEYQzxRo6d034+uqeZrIfs3IZmIWUK/QhCU9NkAMyx5UzylEne/TPQb7+jBf3tS8iY AkVKNNZuRF8w9dX3Z4SQR1vLtEsf/sT0B2KOzTHukE6e7c4nnzAehv+8lB5ZuqHUil3jMfS8jL8 GZxdnNKwQd5dUur+Qmx2A7vLLHKlUYt3HMxuztFFyxIOt0LONaLAyhEoBnKbYewmIC+Q1U5jJ0L luwkHzKn3khRZpIFLxszj828DIcpMez+gzvW1C9jIFPtkVu4K6BC3zChd4NG8LhPguy8m/aetbL Mi1XLS8eyZqCPSl/gjwJ+dNuljemwrPnsdDyPCsGOgrMnFd4k5CuGg== X-Received: by 2002:a05:6000:609:b0:439:c14b:2100 with SMTP id ffacd0b85a97d-43b64243dc6mr1570323f8f.12.1773958174689; Thu, 19 Mar 2026 15:09:34 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Peter Geoghegan Date: Thu, 19 Mar 2026 18:09:07 -0400 X-Gm-Features: AaiRm50AmQ9jbgRWv-ZvS0bP0PKvzhVWLp-5hizt1bGmK88qVT06MSlPobCdVSI Message-ID: Subject: Re: Fix type of 'reduction' variable in _bt_singleval_fillfactor() To: Postgress Cybrosys Cc: pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Mar 19, 2026 at 1:57=E2=80=AFAM Postgress Cybrosys wrote: > While no overflow occurs with current BLCKSZ limits (the product is > at most ~30KB on a standard build, well within INT_MAX), the type > mismatch could silently produce incorrect behaviour on non-standard > builds compiled with a very large BLCKSZ. We don't support BLCKSZ greater than 32KiB. Fields like ItemIdData.lp_len only have space for 15 bits (independent of BLCKSZ itself). Many places (likely thousands) rely on that limit. > In that case, if the > product exceeded INT_MAX, 'reduction' would wrap to a large negative > number. The subsequent check: > > if (state->maxpostingsize > reduction) > state->maxpostingsize -=3D reduction; > > would then subtract a negative value, i.e. increase maxpostingsize > instead of reducing it, silently defeating the single-value fill > strategy entirely. This cannot happen with any supported BLCKSZ. Even if we wanted to support larger BLCKSZ builds, why start here? --=20 Peter Geoghegan