diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2021-12-14 11:46:36 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2021-12-14 11:46:36 -0500 |
commit | 2de3c1015cb2556af501c630b1768a20f111fe95 (patch) | |
tree | 52bcfaf18aaef3395fcc28528dc2d5d7ea514275 /src | |
parent | ece8c76192fee0b78509688325631ceabca44ff5 (diff) | |
download | postgresql-2de3c1015cb2556af501c630b1768a20f111fe95.tar.gz postgresql-2de3c1015cb2556af501c630b1768a20f111fe95.zip |
Fix datatype confusion in logtape.c's right_offset().
This could only matter if (a) long is wider than int, and (b) the heap
of free blocks exceeds UINT_MAX entries, which seems pretty unlikely.
Still, it's a theoretical bug, so backpatch to v13 where the typo came
in (in commit c02fdc922).
In passing, also make swap_nodes() use consistent datatypes.
Ma Liangzhu
Discussion: https://postgr.es/m/17336-fc4e522d26a750fd@postgresql.org
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/utils/sort/logtape.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/sort/logtape.c b/src/backend/utils/sort/logtape.c index 48baccd6a21..722708237b1 100644 --- a/src/backend/utils/sort/logtape.c +++ b/src/backend/utils/sort/logtape.c @@ -343,7 +343,7 @@ ltsReadFillBuffer(LogicalTape *lt) static inline void swap_nodes(long *heap, unsigned long a, unsigned long b) { - unsigned long swap; + long swap; swap = heap[a]; heap[a] = heap[b]; @@ -357,7 +357,7 @@ left_offset(unsigned long i) } static inline unsigned long -right_offset(unsigned i) +right_offset(unsigned long i) { return 2 * i + 2; } |