From: drh Date: Tue, 8 Aug 2017 21:30:43 +0000 (+0000) Subject: Fix a faulty signed/unsigned character comparison in the LIKE optimization X-Git-Tag: version-3.21.0~180 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b8313cc998fa3a9734d4b2fc61339dfa92eced4e;p=thirdparty%2Fsqlite.git Fix a faulty signed/unsigned character comparison in the LIKE optimization logic. FossilOrigin-Name: f4a4b1497355c1b27d3d0770550fffcc3b2d2d51ab284101f19e8fc4264ee675 --- diff --git a/manifest b/manifest index 55f3cb6896..930a5c225b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Enhance\sthe\sCSV\svirtual\stable\sextension\sso\sthat\sit\saccepts\sthe\slast\srow\sof\nthe\sCSV\sfile\seven\sif\sthe\slast\srow\somits\sthe\sclosing\s\\n,\sas\slong\sas\sthe\slast\nrow\shas\sa\sfull\sset\sof\scolumns. -D 2017-08-08T20:03:10.022 +C Fix\sa\sfaulty\ssigned/unsigned\scharacter\scomparison\sin\sthe\sLIKE\soptimization\nlogic. +D 2017-08-08T21:30:43.624 F Makefile.in d9873c9925917cca9990ee24be17eb9613a668012c85a343aef7e5536ae266e8 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 02b469e9dcd5b7ee63fc1fb05babc174260ee4cfa4e0ef2e48c3c6801567a016 @@ -537,7 +537,7 @@ F src/walker.c a7ca64ce08a83a20d32186fbe06bca9234e348cfcf07959ee322fdc3e8a6173a F src/where.c cbe8ddffbcec7ce86f7a800fe8fd10aee412c76c87e0dd3732a1682e68d74cd9 F src/whereInt.h 93bb90b77d39901eda31b44d8e90da1351193ccfe96876f89b58a93a33b84c3d F src/wherecode.c e7be3b7f4c11908500cdf02b299d190d3742659533f58e0f4047962fdb5a48da -F src/whereexpr.c 35d8b33afeedb8009fcd7211e1c848587578b345da93dbed69edc88dffe64c35 +F src/whereexpr.c 1e55d79174522fe3b9b7ab224ebedc03da6ec5e6d204d740fa73e71280f54574 F test/8_3_names.test ebbb5cd36741350040fd28b432ceadf495be25b2 F test/affinity2.test a6d901b436328bd67a79b41bb0ac2663918fe3bd F test/affinity3.test 6a101af2fc945ce2912f6fe54dd646018551710d @@ -1644,7 +1644,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 b26d7a1c7b5d59a2ceabc3716ccea32e26de729eb164a9c0e47f2d8f6ad3df37 -R 56b681b4bac4514f060903132d3e36f0 +P 537e3be2e9503183799afffcd91defc751fea2c779e9b77b77f9485f7de5d170 +R c0257e7418783a1dad51ec17553da8cb U drh -Z ccaffe78aa350be9baaf3161acf84308 +Z eaaf23e57e1119f1d2e06b48f90e37e6 diff --git a/manifest.uuid b/manifest.uuid index 458c1abe12..a06de0d304 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -537e3be2e9503183799afffcd91defc751fea2c779e9b77b77f9485f7de5d170 \ No newline at end of file +f4a4b1497355c1b27d3d0770550fffcc3b2d2d51ab284101f19e8fc4264ee675 \ No newline at end of file diff --git a/src/whereexpr.c b/src/whereexpr.c index 7a70b54451..325b054ea2 100644 --- a/src/whereexpr.c +++ b/src/whereexpr.c @@ -194,7 +194,7 @@ static int isLikeOrGlob( int *pisComplete, /* True if the only wildcard is % in the last character */ int *pnoCase /* True if uppercase is equivalent to lowercase */ ){ - const char *z = 0; /* String on RHS of LIKE operator */ + const u8 *z = 0; /* String on RHS of LIKE operator */ Expr *pRight, *pLeft; /* Right and left size of LIKE operator */ ExprList *pList; /* List of operands to the LIKE operator */ int c; /* One character in z[] */ @@ -221,12 +221,12 @@ static int isLikeOrGlob( int iCol = pRight->iColumn; pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB); if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ - z = (char *)sqlite3_value_text(pVal); + z = sqlite3_value_text(pVal); } sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); }else if( op==TK_STRING ){ - z = pRight->u.zToken; + z = (u8*)pRight->u.zToken; } if( z ){ @@ -269,7 +269,7 @@ static int isLikeOrGlob( *pisComplete = c==wc[0] && z[cnt+1]==0; /* Get the pattern prefix. Remove all escapes from the prefix. */ - pPrefix = sqlite3Expr(db, TK_STRING, z); + pPrefix = sqlite3Expr(db, TK_STRING, (char*)z); if( pPrefix ){ int iFrom, iTo; char *zNew = pPrefix->u.zToken;