mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-10-01 16:01:23 +02:00
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 c02fdc9223
, 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
This commit is contained in:
parent
9b581c5341
commit
52c6c0f196
@ -372,7 +372,7 @@ ltsGetFreeBlock(LogicalTapeSet *lts)
|
||||
{
|
||||
long *heap = lts->freeBlocks;
|
||||
long blocknum;
|
||||
int heapsize;
|
||||
long heapsize;
|
||||
long holeval;
|
||||
unsigned long holepos;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user