Skip to content

Commit 970b97e

Browse files
committed
Fix off_t overflow in pg_basebackup on Windows.
walmethods.c used off_t to navigate around a pg_wal.tar file that could exceed 2GB, which doesn't work on Windows and would fail with misleading errors. Use pgoff_t instead. Back-patch to all supported branches. Author: Davinder Singh <davinder.singh@enterprisedb.com> Reported-by: Jakub Wartak <jakub.wartak@enterprisedb.com> Discussion: https://postgr.es/m/CAKZiRmyM4YnokK6Oenw5JKwAQ3rhP0YTz2T-tiw5dAQjGRXE3Q%40mail.gmail.com
1 parent 026762d commit 970b97e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/bin/pg_basebackup/receivelog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ static bool
191191
close_walfile(StreamCtl *stream, XLogRecPtr pos)
192192
{
193193
char *fn;
194-
off_t currpos;
194+
pgoff_t currpos;
195195
int r;
196196
char walfile_name[MAXPGPATH];
197197

src/bin/pg_basebackup/walmethods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ static const WalWriteMethodOps WalTarMethodOps = {
691691
typedef struct TarMethodFile
692692
{
693693
Walfile base;
694-
off_t ofs_start; /* Where does the *header* for this file start */
694+
pgoff_t ofs_start; /* Where does the *header* for this file start */
695695
char header[TAR_BLOCK_SIZE];
696696
size_t pad_to_size;
697697
} TarMethodFile;

src/bin/pg_basebackup/walmethods.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ typedef struct WalWriteMethod WalWriteMethod;
1717
typedef struct
1818
{
1919
WalWriteMethod *wwmethod;
20-
off_t currpos;
20+
pgoff_t currpos;
2121
char *pathname;
2222

2323
/*

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