1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Avoid calling xRead() on a part of the database file that is memory mapped.

FossilOrigin-Name: c8eac290a7240d69494bd0dad5ed1fdc2505f703
This commit is contained in:
dan
2013-03-21 20:00:07 +00:00
parent 5b068f8632
commit 7c49427fc2
3 changed files with 13 additions and 9 deletions

View File

@@ -5130,9 +5130,13 @@ int sqlite3PagerSharedLock(Pager *pPager){
rc = pagerPagecount(pPager, &nPage);
if( rc ) goto failed;
if( nPage>0 ){
if( nPage>0 || pPager->pMap ){
IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers)));
rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);
if( pPager->pMap ){
memcpy(&dbFileVers, &((u8 *)(pPager->pMap))[24], sizeof(dbFileVers));
}else{
rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);
}
if( rc!=SQLITE_OK ){
goto failed;
}