From: drh <> Date: Tue, 13 Apr 2021 13:20:55 +0000 (+0000) Subject: The SQLITE_NoSchemaError flag should not apply to OOM errors while parsing the X-Git-Tag: version-3.36.0~208 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=569143c851ded2ebb3dce69072eba569190acf82;p=thirdparty%2Fsqlite.git The SQLITE_NoSchemaError flag should not apply to OOM errors while parsing the schema. FossilOrigin-Name: 9cc484ad1a42f0821e53be6df46b1811dc8059e5aaf2f6c3e667105a55893b97 --- diff --git a/manifest b/manifest index 0557b58d8f..665da2457f 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Earlier\sdetection\sempty_result_callbacks\sin\ssqlite3InitCallbac()\sto\savoid\nproblems\swith\scorrupt\sschemas\san\swritable_schema=ON.\ndbsqlfuzz\sca4ca43bdb22eab9859de4979aec615af851e111. -D 2021-04-13T13:01:07.405 +C The\sSQLITE_NoSchemaError\sflag\sshould\snot\sapply\sto\sOOM\serrors\swhile\sparsing\sthe\nschema. +D 2021-04-13T13:20:55.915 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -537,7 +537,7 @@ F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586 F src/pcache1.c 388304fd2d91c39591080b5e0f3c62cfba87db20370e7e0554062bfb29740e9f F src/pragma.c eb42cb9bec189cf18cef5d8fcae56e13bb73ef2b019b198fb48740ced81bce95 F src/pragma.h 8dc78ab7e9ec6ce3ded8332810a2066f1ef6267e2e03cd7356ee00276125c6cf -F src/prepare.c b7e9bb094622b693859f39fc509ebbb9dcfe1e907b5b6b5410b55aa693c6ac14 +F src/prepare.c d778af9986f3b0107c5b255dcfe2696e8e99e00fb77c5115bbfea4e92c3302e7 F src/printf.c 78fabb49b9ac9a12dd1c89d744abdc9b67fd3205e62967e158f78b965a29ec4b F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/resolve.c 059d183511b8211bd019715e66632ac7d314bd90075223a2499a9cc0be4103de @@ -1912,7 +1912,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 69f843c8fa6e21500b5777169c3b394453ba818b4e32427428480dca5b4ed615 -R 2c4ad5fcc8c36287acf12d403dfcc0a6 +P fb305fe077a0058861427f107957fcc3d2b1443cdd11a7f145df138ca3bb9f4e +R 16d2df35bbd6b7e36a26a7b3428902ad U drh -Z 03af19fd6cb1005d4863de667a86ba99 +Z 656f71d21e31ebbc749d2994697a3864 diff --git a/manifest.uuid b/manifest.uuid index b7380389dd..817a69a2f5 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fb305fe077a0058861427f107957fcc3d2b1443cdd11a7f145df138ca3bb9f4e \ No newline at end of file +9cc484ad1a42f0821e53be6df46b1811dc8059e5aaf2f6c3e667105a55893b97 \ No newline at end of file diff --git a/src/prepare.c b/src/prepare.c index dfd351182b..b18716c9e3 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -380,15 +380,17 @@ int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg, u32 mFlags){ if( db->mallocFailed ){ rc = SQLITE_NOMEM_BKPT; sqlite3ResetAllSchemasOfConnection(db); - } + }else if( rc==SQLITE_OK || (db->flags&SQLITE_NoSchemaError)){ - /* Black magic: If the SQLITE_NoSchemaError flag is set, then consider - ** the schema loaded, even if errors occurred. In this situation the - ** current sqlite3_prepare() operation will fail, but the following one - ** will attempt to compile the supplied statement against whatever subset - ** of the schema was loaded before the error occurred. The primary - ** purpose of this is to allow access to the sqlite_schema table - ** even when its contents have been corrupted. + /* Hack: If the SQLITE_NoSchemaError flag is set, then consider + ** the schema loaded, even if errors (other than OOM) occurred. In + ** this situation the current sqlite3_prepare() operation will fail, + ** but the following one will attempt to compile the supplied statement + ** against whatever subset of the schema was loaded before the error + ** occurred. + ** + ** The primary purpose of this is to allow access to the sqlite_schema + ** table even when its contents have been corrupted. */ DbSetProperty(db, iDb, DB_SchemaLoaded); rc = SQLITE_OK;