1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-18 10:21:03 +03:00

Improved defense against OOM errors in sqliteInitOne().

dbsqlfuzz 429db39cd5777c46479641e8637c48c62890042d

FossilOrigin-Name: b6c57e0e2a9658417a0a5548e73007faa59c837b9ad87293bc216feef980717a
This commit is contained in:
drh
2021-06-13 17:55:58 +00:00
parent bd0d62c35b
commit 7a7cefa0b8
3 changed files with 10 additions and 8 deletions

View File

@@ -377,9 +377,11 @@ int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){
}
#endif
}
assert( pDb == &(db->aDb[iDb]) );
if( db->mallocFailed ){
rc = SQLITE_NOMEM_BKPT;
sqlite3ResetAllSchemasOfConnection(db);
pDb = &db->aDb[iDb];
}else
if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){
/* Hack: If the SQLITE_NoSchemaError flag is set, then consider