postgresql/src/backend/utils/sort
Michael Paquier d2bd4ba305 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
2023-08-30 08:03:52 +09:00
..
Makefile Invent qsort_interruptible(). 2022-07-12 16:30:36 -04:00
logtape.c Avoid possible overflow with ltsGetFreeBlock() in logtape.c 2023-08-30 08:03:52 +09:00
qsort_interruptible.c Invent qsort_interruptible(). 2022-07-12 16:30:36 -04:00
sharedtuplestore.c Fix rare sharedtuplestore.c corruption. 2023-01-26 14:54:17 +13:00
sortsupport.c Update copyright for 2021 2021-01-02 13:06:25 -05:00
tuplesort.c Fix CLUSTER tuplesorts on abbreviated expressions. 2022-04-20 17:17:41 -07:00
tuplestore.c Update copyright for 2021 2021-01-02 13:06:25 -05:00