Avoid a possible overflow (src/backend/utils/sort/logtape.c) - Mailing list pgsql-hackers

From Ranier Vilela
Subject Avoid a possible overflow (src/backend/utils/sort/logtape.c)
Date
Msg-id CAEudQApLDWCBR_xmwNjGBrDo+f+S4E87x3s7-+hoaKqYdtC4JQ@mail.gmail.com
Whole thread Raw
Responses Re: Avoid a possible overflow (src/backend/utils/sort/logtape.c)
List pgsql-hackers
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
Attachment

pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: add timing information to pg_upgrade
Next
From: "Tristan Partin"
Date:
Subject: Re: Make documentation builds reproducible