1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix other potentiall pointer aliasing problems associated with subclassing

of the sqlite3_file object for various VFS implementations.

FossilOrigin-Name: 270ac1a0f232d75537be40abae559004e950b992cb2c7e94cd6de66e96ae17bd
This commit is contained in:
drh
2020-07-24 09:17:42 +00:00
parent d9059bdb5b
commit 0c52f5a2b0
8 changed files with 20 additions and 1891 deletions

View File

@@ -439,7 +439,7 @@ static int apndOpen(
p = (ApndFile*)pFile; p = (ApndFile*)pFile;
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
pSubFile = ORIGFILE(pFile); pSubFile = ORIGFILE(pFile);
p->base.pMethods = &apnd_io_methods; pFile->pMethods = &apnd_io_methods;
rc = pSubVfs->xOpen(pSubVfs, zName, pSubFile, flags, pOutFlags); rc = pSubVfs->xOpen(pSubVfs, zName, pSubFile, flags, pOutFlags);
if( rc ) goto apnd_open_done; if( rc ) goto apnd_open_done;
rc = pSubFile->pMethods->xFileSize(pSubFile, &sz); rc = pSubFile->pMethods->xFileSize(pSubFile, &sz);

View File

@@ -634,7 +634,7 @@ static int cksmOpen(
p = (CksmFile*)pFile; p = (CksmFile*)pFile;
memset(p, 0, sizeof(*p)); memset(p, 0, sizeof(*p));
pSubFile = ORIGFILE(pFile); pSubFile = ORIGFILE(pFile);
p->base.pMethods = &cksm_io_methods; pFile->pMethods = &cksm_io_methods;
rc = pSubVfs->xOpen(pSubVfs, zName, pSubFile, flags, pOutFlags); rc = pSubVfs->xOpen(pSubVfs, zName, pSubFile, flags, pOutFlags);
if( rc ) goto cksm_open_done; if( rc ) goto cksm_open_done;
if( flags & SQLITE_OPEN_WAL ){ if( flags & SQLITE_OPEN_WAL ){

1895
manifest

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1 @@
892e9191dc8f805678a501db1993437ee99a1e1849496a0a24ceec9b84123257 270ac1a0f232d75537be40abae559004e950b992cb2c7e94cd6de66e96ae17bd

View File

@@ -339,7 +339,7 @@ static int memdbOpen(
p->mFlags = SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE; p->mFlags = SQLITE_DESERIALIZE_RESIZEABLE | SQLITE_DESERIALIZE_FREEONCLOSE;
assert( pOutFlags!=0 ); /* True because flags==SQLITE_OPEN_MAIN_DB */ assert( pOutFlags!=0 ); /* True because flags==SQLITE_OPEN_MAIN_DB */
*pOutFlags = flags | SQLITE_OPEN_MEMORY; *pOutFlags = flags | SQLITE_OPEN_MEMORY;
p->base.pMethods = &memdb_io_methods; pFile->pMethods = &memdb_io_methods;
p->szMax = sqlite3GlobalConfig.mxMemdbSize; p->szMax = sqlite3GlobalConfig.mxMemdbSize;
return SQLITE_OK; return SQLITE_OK;
} }

View File

@@ -5692,7 +5692,7 @@ static int fillInUnixFile(
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
if( h>=0 ) robust_close(pNew, h, __LINE__); if( h>=0 ) robust_close(pNew, h, __LINE__);
}else{ }else{
pNew->pMethod = pLockingStyle; pId->pMethods = pLockingStyle;
OpenCounter(+1); OpenCounter(+1);
verifyDbFile(pNew); verifyDbFile(pNew);
} }

View File

@@ -5266,7 +5266,7 @@ static int winOpen(
} }
sqlite3_free(zTmpname); sqlite3_free(zTmpname);
pFile->pMethod = pAppData ? pAppData->pMethod : &winIoMethod; id->pMethods = pAppData ? pAppData->pMethod : &winIoMethod;
pFile->pVfs = pVfs; pFile->pVfs = pVfs;
pFile->h = h; pFile->h = h;
if( isReadonly ){ if( isReadonly ){

View File

@@ -591,9 +591,9 @@ static int multiplexOpen(
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){
if( pSubOpen->pMethods->iVersion==1 ){ if( pSubOpen->pMethods->iVersion==1 ){
pMultiplexOpen->base.pMethods = &gMultiplex.sIoMethodsV1; pConn->pMethods = &gMultiplex.sIoMethodsV1;
}else{ }else{
pMultiplexOpen->base.pMethods = &gMultiplex.sIoMethodsV2; pConn->pMethods = &gMultiplex.sIoMethodsV2;
} }
}else{ }else{
multiplexFreeComponents(pGroup); multiplexFreeComponents(pGroup);