1
0
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:
dan
2010-07-07 09:48:44 +00:00
parent 4d9a7bf990
commit bd0e9070e5
5 changed files with 90 additions and 25 deletions

View File

@@ -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 */