aboutsummaryrefslogtreecommitdiff
path: root/src/wal.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2010-07-07 09:48:44 +0000
committerdan <dan@noemail.net>2010-07-07 09:48:44 +0000
commitbd0e9070e5edcfed7542d0edc46e5f95118eaeb3 (patch)
treee9206b39b403ea5659e5bd343f9d2661bc00c309 /src/wal.c
parent4d9a7bf990aac0b4c5c81eb32fd4e04c13deded6 (diff)
downloadsqlite-bd0e9070e5edcfed7542d0edc46e5f95118eaeb3.tar.gz
sqlite-bd0e9070e5edcfed7542d0edc46e5f95118eaeb3.zip
Fix a problem with writing to databases larger than 2^32 bytes with WAL mode.
FossilOrigin-Name: b956ddca75d64ba662fa0b03b643822d836b6501
Diffstat (limited to 'src/wal.c')
-rw-r--r--src/wal.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/wal.c b/src/wal.c
index 3e799d206..cab94d3f8 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -396,7 +396,7 @@ struct WalCkptInfo {
** is to the start of the write-ahead log frame-header.
*/
#define walFrameOffset(iFrame, szPage) ( \
- WAL_HDRSIZE + ((iFrame)-1)*((szPage)+WAL_FRAME_HDRSIZE) \
+ WAL_HDRSIZE + ((iFrame)-1)*(i64)((szPage)+WAL_FRAME_HDRSIZE) \
)
/*
@@ -1577,9 +1577,11 @@ static int walCheckpoint(
rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage,
walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE
);
- if( rc!=SQLITE_OK ) break;
- rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, (iDbpage-1)*szPage);
- if( rc!=SQLITE_OK ) break;
+ if( rc==SQLITE_OK ){
+ i64 iOffset = (i64)(iDbpage-1)*szPage;
+ testcase( iOffset > (((i64)1)<<32) );
+ rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset);
+ }
}
/* If work was actually accomplished... */
@@ -2413,7 +2415,6 @@ int sqlite3WalFrames(
i64 iOffset; /* Write offset in log file */
void *pData;
-
iOffset = walFrameOffset(++iFrame, szPage);
/* Populate and write the frame header */