From: drh Date: Thu, 21 Sep 2017 19:08:25 +0000 (+0000) Subject: Fix harmless UB in the ICU extension. X-Git-Tag: version-3.21.0~67 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8dfde89bc655104e5e7d79f8ca22ac07c07405cd;p=thirdparty%2Fsqlite.git Fix harmless UB in the ICU extension. FossilOrigin-Name: 68e9a840d9cfbf4988e1a68c34e809d15d0235998cf0bfa147a1ab88ea842a61 --- diff --git a/ext/icu/icu.c b/ext/icu/icu.c index 7c37812d86..33c4aa76f3 100644 --- a/ext/icu/icu.c +++ b/ext/icu/icu.c @@ -102,15 +102,15 @@ static int icuLikeCompare( const uint8_t *zString, /* The UTF-8 string to compare against */ const UChar32 uEsc /* The escape character */ ){ - static const int MATCH_ONE = (UChar32)'_'; - static const int MATCH_ALL = (UChar32)'%'; + static const uint32_t MATCH_ONE = (uint32_t)'_'; + static const uint32_t MATCH_ALL = (uint32_t)'%'; int prevEscape = 0; /* True if the previous character was uEsc */ while( 1 ){ /* Read (and consume) the next character from the input pattern. */ - UChar32 uPattern; + uint32_t uPattern; SQLITE_ICU_READ_UTF8(zPattern, uPattern); if( uPattern==0 ) break; @@ -152,16 +152,16 @@ static int icuLikeCompare( if( *zString==0 ) return 0; SQLITE_ICU_SKIP_UTF8(zString); - }else if( !prevEscape && uPattern==uEsc){ + }else if( !prevEscape && uPattern==(uint32_t)uEsc){ /* Case 3. */ prevEscape = 1; }else{ /* Case 4. */ - UChar32 uString; + uint32_t uString; SQLITE_ICU_READ_UTF8(zString, uString); - uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT); - uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT); + uString = (uint32_t)u_foldCase((UChar32)uString, U_FOLD_CASE_DEFAULT); + uPattern = (uint32_t)u_foldCase((UChar32)uPattern, U_FOLD_CASE_DEFAULT); if( uString!=uPattern ){ return 0; } diff --git a/manifest b/manifest index 77b149ba34..2fc89bf1f8 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\spotential\suse\sof\san\suninitialized\spointer\sin\sRTree\sfollowing\san\sOOM\nerror. -D 2017-09-21T13:11:47.775 +C Fix\sharmless\sUB\sin\sthe\sICU\sextension. +D 2017-09-21T19:08:25.780 F Makefile.in 4bc36d913c2e3e2d326d588d72f618ac9788b2fd4b7efda61102611a6495c3ff F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc 6033b51b6aea702ea059f6ab2d47b1d3cef648695f787247dd4fb395fe60673f @@ -209,7 +209,7 @@ F ext/fts5/tool/loadfts5.tcl 95b03429ee6b138645703c6ca192c3ac96eaf093 F ext/fts5/tool/mkfts5c.tcl d1c2a9ab8e0ec690a52316f33dd9b1d379942f45 F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt d9fbbad0c2f647c3fdf715fc9fd64af53aedfc43 -F ext/icu/icu.c 84900472a088a3a172c6c079f58a1d3a1952c332 +F ext/icu/icu.c 635775226d07c743c770888a9dd5175afc6e67d3e28a4032b7fedc3bcaa92e65 F ext/icu/sqliteicu.h 728867a802baa5a96de7495e9689a8e01715ef37 F ext/lsm1/Makefile 2951812df1c1cbc9e023af7e070876f479b3d75ce3898b3b9d00f83fecf13608 F ext/lsm1/Makefile.msc f8c878b467232226de288da320e1ac71c131f5ec91e08b21f502303347260013 @@ -1655,7 +1655,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 65765222ef6f4e80c05a24994fcee145f5fbc0ad35c9fab3d75492964b3eb187 -R 02da5e87646960e2ec34004109ee9fa5 +P fd4ec0cdbd84f3333dd4c7a4236491bce6b9ab21fb2c088751ca1279b31bd864 +R e47dc725154fea483b788f56f70bc385 U drh -Z 12b5a29a0408d0f6f2c00a6a52186774 +Z a934d9409a25854b9c4537ba2fad9aea diff --git a/manifest.uuid b/manifest.uuid index 5ad688b147..29b34cf006 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -fd4ec0cdbd84f3333dd4c7a4236491bce6b9ab21fb2c088751ca1279b31bd864 \ No newline at end of file +68e9a840d9cfbf4988e1a68c34e809d15d0235998cf0bfa147a1ab88ea842a61 \ No newline at end of file