pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Avoid possible overflow with ltsGetFreeBlock() in logtape.c
Date: Tue, 29 Aug 2023 23:04:50 +0000
Message-ID: <E1qb7lS-001aai-3z@gemulon.postgresql.org> (raw)

Avoid possible overflow with ltsGetFreeBlock() in logtape.c

nFreeBlocks, defined as a long, stores the number of free blocks in a
logical tape.  ltsGetFreeBlock() has been using an int to store the
value of nFreeBlocks, which could lead to overflows on platforms where
long and int are not the same size (in short everything except Windows
where long is 4 bytes).

The problematic intermediate variable is switched to be a long instead
of an int.

Issue introduced by c02fdc9223015, so backpatch down to 13.

Author: Ranier vilela
Reviewed-by: Peter Geoghegan, David Rowley
Discussion: https://postgr.es/m/CAEudQApLDWCBR_xmwNjGBrDo+f+S4E87x3s7-+hoaKqYdtC4JQ@mail.gmail.com
Backpatch-through: 13

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/420c8dc7ec67ca050d53c559d1e852c59e7053ef

Modified Files
--------------
src/backend/utils/sort/logtape.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



view thread (5+ messages)

Message-ID: <E1qb7lS-001aai-3z@gemulon.postgresql.org>
Permalink:  ../E1qb7lS-001aai-3z@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qb7lS-001aai-3z@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Avoid possible overflow with ltsGetFreeBlock() in logtape.c
  In-Reply-To: <E1qb7lS-001aai-3z@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox