Skip to content

Commit faee318

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 af109e3 commit faee318

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
@@ -192,7 +192,7 @@ static bool
192192
close_walfile(StreamCtl *stream, XLogRecPtr pos)
193193
{
194194
char *fn;
195-
off_t currpos;
195+
pgoff_t currpos;
196196
int r;
197197
char walfile_name[MAXPGPATH];
198198

src/bin/pg_basebackup/walmethods.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,7 @@ 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