Skip to content

Commit 25c7faa

Browse files
committed
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 c02fdc9). In passing, also make swap_nodes() use consistent datatypes. Ma Liangzhu Discussion: https://postgr.es/m/17336-fc4e522d26a750fd@postgresql.org
1 parent 4be3e00 commit 25c7faa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/sort/logtape.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ ltsReadFillBuffer(LogicalTapeSet *lts, LogicalTape *lt)
345345
static inline void
346346
swap_nodes(long *heap, unsigned long a, unsigned long b)
347347
{
348-
unsigned long swap;
348+
long swap;
349349

350350
swap = heap[a];
351351
heap[a] = heap[b];
@@ -359,7 +359,7 @@ left_offset(unsigned long i)
359359
}
360360

361361
static inline unsigned long
362-
right_offset(unsigned i)
362+
right_offset(unsigned long i)
363363
{
364364
return 2 * i + 2;
365365
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy