The keywords TRUE and FALSE should only act as boolean literal values if

unquoted.

FossilOrigin-Name: 5547f39de993c708f72301ef25df190a2f007e0c4253799bdd9e86bb1ae41777
This commit is contained in:
drh 2019-01-11 13:32:23 +00:00
parent e65b9c6a5e
commit 51d35b0fa9
6 changed files with 23 additions and 17 deletions

View File

@ -1,5 +1,5 @@
C Separate\smakefile\stargets\sfor\s"dbfuzz2",\s"dbfuzz2-asan",\sand\s"dbfuzz2-msan".
D 2019-01-11T13:03:06.705
C The\skeywords\sTRUE\sand\sFALSE\sshould\sonly\sact\sas\sboolean\sliteral\svalues\sif\nunquoted.
D 2019-01-11T13:32:23.943
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F Makefile.in 45a3fef4d325ac0220c2172aeec4e4321da351f073f3b8e8ddea655f49ef6f2b
@ -464,7 +464,7 @@ F src/date.c ebe1dc7c8a347117bb02570f1a931c62dd78f4a2b1b516f4837d45b7d6426957
F src/dbpage.c 135eb3b5e74f9ef74bde5cec2571192c90c86984fa534c88bf4a055076fa19b7
F src/dbstat.c c12833de69cb655751487d2c5a59607e36be1c58ba1f4bd536609909ad47b319
F src/delete.c 209cd8345b15d1843abeff2d91a6d9c765cf32ff4abcb24411c38fe08e18baab
F src/expr.c 9ad9c40a83c4218d79de19153b7a8ba7810564a123af7e09281927990bea2964
F src/expr.c 01aa7e667b65fc18ccbe41d00c9a114cb2658831be13d9847a376a88ba2f3ae9
F src/fault.c 460f3e55994363812d9d60844b2a6de88826e007
F src/fkey.c aaf28be73ab21e1e8bf4ac6b94269ebc8c93238d1e6997cb44b527b622e8ae6f
F src/func.c 6cf832abbc2815fdb46fee654df32a66ab77deb47bf4cff04a5774dafecd497a
@ -501,7 +501,7 @@ F src/os_win.c 85d9e532d0444ab6c16d7431490c2e279e282aa0917b0e988996b1ae0de5c5a0
F src/os_win.h 7b073010f1451abe501be30d12f6bc599824944a
F src/pager.c 75e0f3cfa3962c714f519f8a3d1e67ecca1c91de0e010a036b988e40ce9e4c73
F src/pager.h 217921e81eb5fe455caa5cda96061959706bcdd29ddb57166198645ef7822ac3
F src/parse.y a3c0db595bc642c6ee1d72869842f7f5b0b6ebeb91c21d0a7cba631d27e7afbd
F src/parse.y e801b38c434b9cb30506dcf8e16b5641a5d54f26ca957a8313372c5156ded86e
F src/pcache.c 696a01f1a6370c1b50a09c15972bc3bee3333f8fcd1f2da8e9a76b1b062c59ee
F src/pcache.h 4f87acd914cef5016fae3030343540d75f5b85a1877eed1a2a19b9f284248586
F src/pcache1.c fffd5250a323579384a3b3904302b9fe87e186ba24602af3013f749a0234ae98
@ -517,7 +517,7 @@ F src/shell.c.in 0722a9e3a1b23674f07c194b8f71c953c775bad280e7f179a32bf72cd009b56
F src/sqlite.h.in b54cd42d2f3b739a00de540cafe2dcd0de3b8e1748a2db33a68def487e9e602f
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
F src/sqlite3ext.h 960f1b86c3610fa23cb6a267572a97dcf286e77aa0dd3b9b23292ffaa1ea8683
F src/sqliteInt.h 829bebd46e570fc1a22923df111417145b394b9c198a9c68c2d7b9a4243b9c29
F src/sqliteInt.h 348bc49c8e03865d1bdbe350e3e5708af972210d92307c5b467caa25544705c0
F src/sqliteLimit.h 1513bfb7b20378aa0041e7022d04acb73525de35b80b252f1b83fedb4de6a76b
F src/status.c 46e7aec11f79dad50965a5ca5fa9de009f7d6bde08be2156f1538a0a296d4d0e
F src/table.c b46ad567748f24a326d9de40e5b9659f96ffff34
@ -581,7 +581,7 @@ F src/trigger.c 77546bf525854aa4dc09f3a0450fa801c3e99d5f13a3eb2efd07bfe521e3b5d6
F src/update.c 4e630e47852e206d0b29ec63ea0402e0b7ba328a1c19dd645ae8ac7bd0a378cf
F src/upsert.c 0dd81b40206841814d46942a7337786932475f085716042d0cb2fc7791bf8ca4
F src/utf.c 810fbfebe12359f10bc2a011520a6e10879ab2a163bcb26c74768eab82ea62a5
F src/util.c d9eb0a6c4aae1b00a7369eadd7ca0bbe946cb4c953b6751aa20d357c2f482157
F src/util.c 82a2e3f691a3b654be872e305dab1f455e565dedf5e6a90c818c1ab307c00432
F src/vacuum.c a9f389f41556c0ec310bc9169dc9476603c30a0a913ad92bfbc75c86886967ca
F src/vdbe.c 1919d490e97bfc59eab4d43444a53a6717d06137295ed684a25e5df7430d9974
F src/vdbe.h 712bca562eaed1c25506b9faf9680bdc75fc42e2f4a1cd518d883fa79c7a4237
@ -1797,7 +1797,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 240f1c0c92cad8a1c19438b38489aedb831f62a4603c53f22367e876d8f644ff
R 97cd1020543aae6c3b535334385150bf
P ea119641a7edcd0e1ec14371d93e35f860971888bd98cb0019253358a2ef123b
R 4eecebacc4e6734941d82a3d523ec21e
U drh
Z dd51adc1b571f184664beeec5f4ba112
Z b60d127ddfa423bbb0ec667e5145ee61

View File

@ -1 +1 @@
ea119641a7edcd0e1ec14371d93e35f860971888bd98cb0019253358a2ef123b
5547f39de993c708f72301ef25df190a2f007e0c4253799bdd9e86bb1ae41777

View File

@ -780,8 +780,7 @@ Expr *sqlite3ExprAlloc(
if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n);
pNew->u.zToken[pToken->n] = 0;
if( dequote && sqlite3Isquote(pNew->u.zToken[0]) ){
if( pNew->u.zToken[0]=='"' ) pNew->flags |= EP_DblQuoted;
sqlite3Dequote(pNew->u.zToken);
sqlite3DequoteExpr(pNew);
}
}
}
@ -1812,8 +1811,9 @@ int sqlite3SelectWalkFail(Walker *pWalker, Select *NotUsed){
*/
int sqlite3ExprIdToTrueFalse(Expr *pExpr){
assert( pExpr->op==TK_ID || pExpr->op==TK_STRING );
if( sqlite3StrICmp(pExpr->u.zToken, "true")==0
|| sqlite3StrICmp(pExpr->u.zToken, "false")==0
if( !ExprHasProperty(pExpr, EP_Quoted)
&& (sqlite3StrICmp(pExpr->u.zToken, "true")==0
|| sqlite3StrICmp(pExpr->u.zToken, "false")==0)
){
pExpr->op = TK_TRUEFALSE;
return 1;

View File

@ -955,8 +955,7 @@ idlist(A) ::= nm(Y).
memcpy(p->u.zToken, t.z, t.n);
p->u.zToken[t.n] = 0;
if( sqlite3Isquote(p->u.zToken[0]) ){
if( p->u.zToken[0]=='"' ) p->flags |= EP_DblQuoted;
sqlite3Dequote(p->u.zToken);
sqlite3DequoteExpr(p);
}
#if SQLITE_MAX_EXPR_DEPTH>0
p->nHeight = 1;

View File

@ -2522,6 +2522,7 @@ struct Expr {
#define EP_Leaf 0x800000 /* Expr.pLeft, .pRight, .u.pSelect all NULL */
#define EP_WinFunc 0x1000000 /* TK_FUNCTION with Expr.y.pWin set */
#define EP_Subrtn 0x2000000 /* Uses Expr.y.sub. TK_IN, _SELECT, or _EXISTS */
#define EP_Quoted 0x4000000 /* TK_ID was originally quoted */
/*
** The EP_Propagate mask is a set of properties that automatically propagate
@ -3814,6 +3815,7 @@ char *sqlite3VMPrintf(sqlite3*,const char*, va_list);
void sqlite3SetString(char **, sqlite3*, const char*);
void sqlite3ErrorMsg(Parse*, const char*, ...);
void sqlite3Dequote(char*);
void sqlite3DequoteExpr(Expr*);
void sqlite3TokenInit(Token*,char*);
int sqlite3KeywordCode(const unsigned char*, int);
int sqlite3RunParser(Parse*, const char*, char **);

View File

@ -238,7 +238,7 @@ void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){
** dequoted string, exclusive of the zero terminator, if dequoting does
** occur.
**
** 2002-Feb-14: This routine is extended to remove MS-Access style
** 2002-02-14: This routine is extended to remove MS-Access style
** brackets from around identifiers. For example: "[a-b-c]" becomes
** "a-b-c".
*/
@ -264,6 +264,11 @@ void sqlite3Dequote(char *z){
}
z[j] = 0;
}
void sqlite3DequoteExpr(Expr *p){
assert( sqlite3Isquote(p->u.zToken[0]) );
p->flags |= p->u.zToken[0]=='"' ? EP_Quoted|EP_DblQuoted : EP_Quoted;
sqlite3Dequote(p->u.zToken);
}
/*
** Generate a Token object from a string