Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2de3c10

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 ece8c76 commit 2de3c10

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/backend/utils/sort/logtape.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ ltsReadFillBuffer(LogicalTape *lt)
343343
static inline void
344344
swap_nodes(long *heap, unsigned long a, unsigned long b)
345345
{
346-
unsigned long swap;
346+
long swap;
347347

348348
swap = heap[a];
349349
heap[a] = heap[b];
@@ -357,7 +357,7 @@ left_offset(unsigned long i)
357357
}
358358

359359
static inline unsigned long
360-
right_offset(unsigned i)
360+
right_offset(unsigned long i)
361361
{
362362
return 2 * i + 2;
363363
}

0 commit comments

Comments
 (0)