From: dan Date: Wed, 20 May 2015 19:57:02 +0000 (+0000) Subject: When parsing the schema, ignore any SQL that does not begin with "CREATE". Cherrypick... X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5be8f7a5a16410b42cad89a7a23f910d771325a7;p=thirdparty%2Fsqlite.git When parsing the schema, ignore any SQL that does not begin with "CREATE". Cherrypick of [d3c00d61581c]. FossilOrigin-Name: 0da229b81ad29d731789c86abadf2abc9bfcd738 --- diff --git a/manifest b/manifest index 19e087117d..68ab244231 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Detect\sand\sreport\soversized\srecords\sconstructed\sfrom\smultiple\szeroblobs.\sCherrypick\sof\s[9e139afd9211]. -D 2015-05-20T19:53:17.165 +C When\sparsing\sthe\sschema,\signore\sany\sSQL\sthat\sdoes\snot\sbegin\swith\s"CREATE".\sCherrypick\sof\s[d3c00d61581c]. +D 2015-05-20T19:57:02.125 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5eb79e334a5de69c87740edd56af6527dd219308 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -217,7 +217,7 @@ F src/pcache.c d8eafac28290d4bb80332005435db44991d07fc2 F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222 F src/pcache1.c 102e6f5a2fbc646154463eb856d1fd716867b64c F src/pragma.c d10ef67c4de79f78188b965b4b7988aff1d66f2e -F src/prepare.c 677521ab7132615a8a26107a1d1c3132f44ae337 +F src/prepare.c 6c427840bc90233b0eef4c6ffb3bed42967c51ab F src/printf.c 1c030b72d7678386dc359e296fdd3b6214a2aadb F src/random.c d10c1f85b6709ca97278428fd5db5bbb9c74eece F src/resolve.c 0ea356d32a5e884add23d1b9b4e8736681dd5697 @@ -309,7 +309,7 @@ F test/alter3.test 49c9d9fba2b8fcdce2dedeca97bbf1f369cc548d F test/alter4.test d6c011fa0d6227abba762498cafbb607c9609e93 F test/altermalloc.test e81ac9657ed25c6c5bb09bebfa5a047cd8e4acfc F test/amatch1.test b5ae7065f042b7f4c1c922933f4700add50cdb9f -F test/analyze.test 1772936d66471c65221e437b6d1999c3a03166c4 +F test/analyze.test 3eb35a4af972f98422e5dc0586501b17d103d321 F test/analyze3.test bf41f0f680dd1e0d44eed5e769531e93a5320275 F test/analyze4.test eff2df19b8dd84529966420f29ea52edc6b56213 F test/analyze5.test 765c4e284aa69ca172772aa940946f55629bc8c4 @@ -621,7 +621,7 @@ F test/incrvacuum3.test 75256fb1377e7c39ef2de62bfc42bbff67be295a F test/incrvacuum_ioerr.test 6ae2f783424e47a0033304808fe27789cf93e635 F test/index.test 4d990005a67a36984e4f1a5f1bdccea8d08da4ee F test/index2.test ee83c6b5e3173a3d7137140d945d9a5d4fdfb9d6 -F test/index3.test 55a90cff99834305e8141df7afaef39674b57062 +F test/index3.test b6ec456cf3b81d9a32123fe7e449bde434db338b F test/index4.test ab92e736d5946840236cd61ac3191f91a7856bf6 F test/index5.test fc07c14193c0430814e7a08b5da46888ee795c33 F test/index6.test fb370966ac3cd0989053dd5385757b5c3e24ab6a @@ -1029,7 +1029,7 @@ F test/trigger3.test aa640bb2bbb03edd5ff69c055117ea088f121945 F test/trigger4.test 74700b76ebf3947b2f7a92405141eb2cf2a5d359 F test/trigger5.test 619391a3e9fc194081d22cefd830d811e7badf83 F test/trigger6.test 0e411654f122552da6590f0b4e6f781048a4a9b9 -F test/trigger7.test b39e6dee1debe0ff9c2ef66326668f149f07c9c4 +F test/trigger7.test 200dd51e728c9cdc20c72d99d9e9d45c667248f8 F test/trigger8.test 30cb0530bd7c4728055420e3f739aa00412eafa4 F test/trigger9.test 5b0789f1c5c4600961f8e68511b825b87be53e31 F test/triggerA.test fe5597f47ee21bacb4936dc827994ed94161e332 @@ -1186,8 +1186,8 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 023a29baf0de7e4d2e7a7b5bc184bbad6eb34b8d -Q +9e139afd92116ebc593114ed63b57c8f469653f6 -R 3ff98e73d4f5cf4e3414b23e36825367 +P 4a08f6b8bb0d4f5e565fd05a48d0b1af04b9eb2d +Q +d3c00d61581c8ba6dce5618391432d3af8d324d4 +R d9d9bb19f146fc0be4ab4dab0330d25d U dan -Z 02291f8fc5c2aa03372282523cfd6f55 +Z 987c5b3ef0719b604f1812a4747b05af diff --git a/manifest.uuid b/manifest.uuid index fca245ae5d..554148ddec 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4a08f6b8bb0d4f5e565fd05a48d0b1af04b9eb2d \ No newline at end of file +0da229b81ad29d731789c86abadf2abc9bfcd738 \ No newline at end of file diff --git a/src/prepare.c b/src/prepare.c index c7ba53a1f5..9a0772037f 100644 --- a/src/prepare.c +++ b/src/prepare.c @@ -67,7 +67,7 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){ if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */ if( argv[1]==0 ){ corruptSchema(pData, argv[0], 0); - }else if( argv[2] && argv[2][0] ){ + }else if( sqlite3_strnicmp(argv[2],"create ",7)==0 ){ /* Call the parser to process a CREATE TABLE, INDEX or VIEW. ** But because db->init.busy is set to 1, no VDBE code is generated ** or executed. All the parser does is build the internal data @@ -98,8 +98,8 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){ } } sqlite3_finalize(pStmt); - }else if( argv[0]==0 ){ - corruptSchema(pData, 0, 0); + }else if( argv[0]==0 || (argv[2]!=0 && argv[2][0]!=0) ){ + corruptSchema(pData, argv[0], 0); }else{ /* If the SQL column is blank it means this is an index that ** was created to be the PRIMARY KEY or to fulfill a UNIQUE diff --git a/test/analyze.test b/test/analyze.test index c445084263..af277cc835 100644 --- a/test/analyze.test +++ b/test/analyze.test @@ -359,6 +359,6 @@ do_test analyze-99.1 { catchsql { ANALYZE } -} {1 {malformed database schema (sqlite_stat1) - near "nonsense": syntax error}} +} {1 {malformed database schema (sqlite_stat1)}} finish_test diff --git a/test/index3.test b/test/index3.test index a9f9b7ae6f..0cdc6e088d 100644 --- a/test/index3.test +++ b/test/index3.test @@ -51,6 +51,6 @@ do_test index3-99.1 { db close catch { sqlite3 db test.db } catchsql { DROP INDEX i1 } -} {1 {malformed database schema (t1) - near "nonsense": syntax error}} +} {1 {malformed database schema (t1)}} finish_test diff --git a/test/trigger7.test b/test/trigger7.test index 8fde2004f8..221962406b 100644 --- a/test/trigger7.test +++ b/test/trigger7.test @@ -114,6 +114,6 @@ do_test trigger7-99.1 { db close catch { sqlite3 db test.db } catchsql { DROP TRIGGER t2r5 } -} {1 {malformed database schema (t2r12) - near "nonsense": syntax error}} +} {1 {malformed database schema (t2r12)}} finish_test