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:
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user