mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-30 19:03:16 +03:00
Avoid a segfault that could occur when running the recover API on a database handle with memory-mapping enabled.
FossilOrigin-Name: e02c697281a777c33070168af784b2d291397e488244a217620897f40aed7158
This commit is contained in:
@ -2161,6 +2161,8 @@ static int recoverVfsShmMap(sqlite3_file*, int, int, int, void volatile**);
|
||||
static int recoverVfsShmLock(sqlite3_file*, int offset, int n, int flags);
|
||||
static void recoverVfsShmBarrier(sqlite3_file*);
|
||||
static int recoverVfsShmUnmap(sqlite3_file*, int deleteFlag);
|
||||
static int recoverVfsFetch(sqlite3_file*, sqlite3_int64, int, void**);
|
||||
static int recoverVfsUnfetch(sqlite3_file *pFd, sqlite3_int64 iOff, void *p);
|
||||
|
||||
static sqlite3_io_methods recover_methods = {
|
||||
2, /* iVersion */
|
||||
@ -2180,7 +2182,8 @@ static sqlite3_io_methods recover_methods = {
|
||||
recoverVfsShmLock,
|
||||
recoverVfsShmBarrier,
|
||||
recoverVfsShmUnmap,
|
||||
0, 0
|
||||
recoverVfsFetch,
|
||||
recoverVfsUnfetch
|
||||
};
|
||||
|
||||
static int recoverVfsClose(sqlite3_file *pFd){
|
||||
@ -2486,6 +2489,19 @@ static int recoverVfsShmUnmap(sqlite3_file *pFd, int deleteFlag){
|
||||
);
|
||||
}
|
||||
|
||||
static int recoverVfsFetch(
|
||||
sqlite3_file *pFd,
|
||||
sqlite3_int64 iOff,
|
||||
int iAmt,
|
||||
void **pp
|
||||
){
|
||||
*pp = 0;
|
||||
return SQLITE_OK;
|
||||
}
|
||||
static int recoverVfsUnfetch(sqlite3_file *pFd, sqlite3_int64 iOff, void *p){
|
||||
return SQLITE_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
** Install the VFS wrapper around the file-descriptor open on the input
|
||||
** database for recover handle p. Mutex RECOVER_MUTEX_ID must be held
|
||||
|
Reference in New Issue
Block a user