From: drh <> Date: Fri, 26 Jun 2026 13:51:48 +0000 (+0000) Subject: Fix parsing of quoted instantiation arguments in the spellfix extension. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfbeb641de4db424e46a7eb97aeff25fb35276f3;p=thirdparty%2Fsqlite.git Fix parsing of quoted instantiation arguments in the spellfix extension. [bugs:/info/2026-06-26T10:52:36Z|Bug 2026-06-26T10:52:36Z] FossilOrigin-Name: c2e963ad948e0c244d6b883b919ec0815c20018282e04e5649c00e70f5a1d2ed --- diff --git a/ext/misc/spellfix.c b/ext/misc/spellfix.c index f9d9e529ed..b7961dc9c4 100644 --- a/ext/misc/spellfix.c +++ b/ext/misc/spellfix.c @@ -28,8 +28,6 @@ SQLITE_EXTENSION_INIT1 # include # include # include -# define ALWAYS(X) 1 -# define NEVER(X) 0 typedef unsigned char u8; typedef unsigned short u16; typedef sqlite3_int64 i64; @@ -1270,7 +1268,7 @@ static int utf8Read(const unsigned char *z, int n, int *pSize){ /* All callers to this routine (in the current implementation) ** always have n>0. */ - if( NEVER(n==0) ){ + if( n==0 ){ c = i = 0; }else{ c = z[0]; @@ -2020,13 +2018,13 @@ static char *spellfix1Dequote(const char *zIn){ zOut = sqlite3_mprintf("%s", zIn); if( zOut==0 ) return 0; i = (int)strlen(zOut); -#if 0 /* The parser will never leave spaces at the end */ + /* The parser should never leave spaces at the end, but we'll + ** remove them just in case. */ while( i>0 && isspace(zOut[i-1]) ){ i--; } -#endif zOut[i] = 0; c = zOut[0]; if( c=='\'' || c=='"' ){ - for(i=1, j=0; ALWAYS(zOut[i]); i++){ + for(i=1, j=0; zOut[i]; i++){ zOut[j++] = zOut[i]; if( zOut[i]==c ){ if( zOut[i+1]==c ){ diff --git a/manifest b/manifest index db4e308c3f..cfd841edeb 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sunbounded\swhitespace\sskip\sin\sthe\sdecimal\sextension.\n[bugs:/info/2026-06-26T10:06:54Z|Bugs\s2026-06-26T10:06:54Z] -D 2026-06-26T13:41:07.923 +C Fix\sparsing\sof\squoted\sinstantiation\sarguments\sin\sthe\sspellfix\sextension.\n[bugs:/info/2026-06-26T10:52:36Z|Bug\s2026-06-26T10:52:36Z] +D 2026-06-26T13:51:48.749 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -399,7 +399,7 @@ F ext/misc/series.c ba66183ae4da6875e5cdafc065322118fd7f455a568ea2f22b45eff85f63 F ext/misc/sha1.c eed0ad67ad7c69798278183a74523d95623d4864821a3f4dd82b234568e307c1 F ext/misc/shathree.c fd22d70620f86a0467acfdd3acd8435d5cb54eb1e2d9ff36ae44e389826993df F ext/misc/showauth.c 732578f0fe4ce42d577e1c86dc89dd14a006ab52 -F ext/misc/spellfix.c a262267b16f04d30a2896cc1ba644570cbdb55446951f97d026f4e062bd20291 +F ext/misc/spellfix.c 9bef7d381247e20d9da8a74d98a528512daf4c69fb1d7a901ac89d041d5ea27c F ext/misc/sqlar.c 97c100b010159c08a7a9acd8eb1ea510a5522e64741aaafcd7b6c629de682edc F ext/misc/sqlite3_stdio.c b43a0f530c6f0fb3d41d9af8c0b40f3f71198a1db55ab8ffffbef5c8cc329d22 F ext/misc/sqlite3_stdio.h 27a4ecea47e61bc9574ccdf2806f468afe23af2f95028c9b689bfa08ab1ce99f @@ -1676,7 +1676,7 @@ F test/speed4p.test 377a0c48e5a92e0b11c1c5ebb1bc9d83a7312c922bc0cb05970ef5d6a96d F test/speedtest.md ea0c85ebe0ecff8b45ba6cdb26e694871f469009a5a29dcfe634b055f05ab241 F test/speedtest.tcl b06f6321ef90bb68f18f7b0e430e25203d9da79b80f8926986a0d5f21ac485fb x F test/speedtest1.c f9f30f35431bfc1d3ee9acc561624e0c0b4614071044bc302169dd27206a0fca -F test/spellfix.test 8d674c2d4776792cdd982c5a8bbbfd433c23bc98f00127cae83437f5d693e018 +F test/spellfix.test 2dff669793b1c0f682fcea4941cba8aaf899123db252de998b1c84594abc0dc7 F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3 F test/spellfix3.test 0f9efaaa502a0e0a09848028518a6fb096c8ad33 F test/spellfix4.test 7c56a09de68b95051ef0627fe235e514efbba2aa816dc2a9c5c670d98877e632 @@ -2208,8 +2208,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P de40bfb6b39f3252d1dc2dccc04439ac7b40c1331ded60473950cb4b96fc85f7 -R 0c7001d33dac5133c3f448d465512f11 +P 71d4cfe5a34cf8485ab2e5abe670381cd068f013233d98c44355a6bcdfcbbbb0 +R e2235756a2729d379df30d70ed71e6b8 U drh -Z 73ffd9666efc62a72dcb4e7b3152cab3 +Z 3de48b27f723e1a9b8146531036ebbeb # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 62f4263160..132a5aef44 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -71d4cfe5a34cf8485ab2e5abe670381cd068f013233d98c44355a6bcdfcbbbb0 +c2e963ad948e0c244d6b883b919ec0815c20018282e04e5649c00e70f5a1d2ed diff --git a/test/spellfix.test b/test/spellfix.test index dfcee1ac9a..18a5e23f1d 100644 --- a/test/spellfix.test +++ b/test/spellfix.test @@ -425,4 +425,14 @@ do_execsql_test 8.2 { SELECT word FROM t1 WHERE word MATCH ''; } {hello world} +# Bug 2026-06-26T10:52:36Z +# +do_execsql_test 8.3 { + DROP TABLE t1; + CREATE VIRTUAL TABLE t1 USING spellfix1; + INSERT INTO t1(command) VALUES('edit_cost_table=''xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA'); +} {} + + + finish_test