From: drh <> Date: Fri, 21 Jul 2023 18:38:59 +0000 (+0000) Subject: Avoid a potentially large strlen() in sqlite3DecOrHexToI64(). X-Git-Tag: version-3.43.0~125^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=028acd974f3c03c489dfaa02da618af99613cde7;p=thirdparty%2Fsqlite.git Avoid a potentially large strlen() in sqlite3DecOrHexToI64(). FossilOrigin-Name: 5413b02bb629b9cbb76f7e688e94ebcf24276c01436d3feb73ff57c036e1d2aa --- diff --git a/manifest b/manifest index 0ff7e75f17..1fd56ed788 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Further\simprovements\sto\slarge\sstring\shandling\sin\srelation\sto\sJSON. -D 2023-07-21T18:09:07.505 +C Avoid\sa\spotentially\slarge\sstrlen()\sin\ssqlite3DecOrHexToI64(). +D 2023-07-21T18:38:59.114 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -705,7 +705,7 @@ F src/trigger.c ad6ab9452715fa9a8075442e15196022275b414b9141b566af8cdb7a1605f2b0 F src/update.c 0aa36561167a7c40d01163238c297297962f31a15a8d742216b3c37cdf25f731 F src/upsert.c 5303dc6c518fa7d4b280ec65170f465c7a70b7ac2b22491598f6d0b4875b3145 F src/utf.c ee39565f0843775cc2c81135751ddd93eceb91a673ea2c57f61c76f288b041a0 -F src/util.c fea6fffdee3cdae917a66b70deec59d4f238057cfd6de623d15cf990c196940d +F src/util.c c2aa170f2eb429235b1dddce8952770787ffa5124dc89d405bfbe8ebad8e7ebd F src/vacuum.c 604fcdaebe76f3497c855afcbf91b8fa5046b32de3045bab89cc008d68e40104 F src/vdbe.c 4cda877d413a18fa07346b08d6959b3d18ce982357921e7acb9649fca2534a12 F src/vdbe.h 41485521f68e9437fdb7ec4a90f9d86ab294e9bb8281e33b235915e29122cfc0 @@ -2043,8 +2043,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 75cc3c89ee2dcfefa9421ce60bee77e85d2895918e8c5cfd05c434f8932a99b5 -R b0bbcf196bde05ae8f599a4f16022c78 +P 1e5df0aa3dae5cadbf1d07c718ae2a5212543300b68e49d35e8c96855a7f619c +R 985a846b4f2b586d366fd130e337d17a U drh -Z 8dfc9dc2f2e2752cbadaab8d45cf08cb +Z f082f5b7a15300eec42c5fbe873f6275 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 9ac6a758a7..ff10b67548 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1e5df0aa3dae5cadbf1d07c718ae2a5212543300b68e49d35e8c96855a7f619c \ No newline at end of file +5413b02bb629b9cbb76f7e688e94ebcf24276c01436d3feb73ff57c036e1d2aa \ No newline at end of file diff --git a/src/util.c b/src/util.c index 409482d395..1200aef0e3 100644 --- a/src/util.c +++ b/src/util.c @@ -846,7 +846,9 @@ int sqlite3DecOrHexToI64(const char *z, i64 *pOut){ }else #endif /* SQLITE_OMIT_HEX_INTEGER */ { - return sqlite3Atoi64(z, pOut, sqlite3Strlen30(z), SQLITE_UTF8); + int n = (int)(0x3fffffff&strspn(z,"+- \n\t0123456789")); + if( z[n] ) n++; + return sqlite3Atoi64(z, pOut, n, SQLITE_UTF8); } }