Avoid a possible overflow (src/backend/utils/sort/logtape.c)

Ranier Vilela <ranier.vf@gmail.com>

From: Ranier Vilela <ranier.vf@gmail.com>
To: Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-24T17:46:42Z
Lists: pgsql-hackers

Attachments

Hi,

nFreeBlocks stores the number of free blocks and
your type is *long*.

At Function ltsGetFreeBlock is locally stored in
heapsize wich type is *int*

With Windows both *long* and *int* are 4 bytes.
But with Linux *long* is 8 bytes and *int* are 4 bytes.

patch attached.

best regards,
Ranier Vilela

Commits

  1. Avoid possible overflow with ltsGetFreeBlock() in logtape.c