mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-05 15:55:57 +03:00
Fix a problem with writing to databases larger than 2^32 bytes with WAL mode.
FossilOrigin-Name: b956ddca75d64ba662fa0b03b643822d836b6501
This commit is contained in:
11
src/wal.c
11
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 */
|
||||
|
Reference in New Issue
Block a user