From: drh <> Date: Thu, 26 Mar 2026 18:19:47 +0000 (+0000) Subject: Enhance the return value from sqlite3AtoF() so that it reports if the input X-Git-Tag: major-release~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4af925e34f37f781794934146549768fc1017f3;p=thirdparty%2Fsqlite.git Enhance the return value from sqlite3AtoF() so that it reports if the input includes more than 19.25 significant digits. FossilOrigin-Name: 1721c8da769816ca16104cd636299d84f682fc004938a50056b76b269e49e915 --- diff --git a/manifest b/manifest index 015227fdbc..c7be632960 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Revamp\sthe\sreturn\scode\sfrom\ssqlite3AtoF()\sfor\sadditional\sinformation\sand\nfor\ssmall\sspeed\simprovement\sand\ssize\sreduction. -D 2026-03-26T16:33:03.990 +C Enhance\sthe\sreturn\svalue\sfrom\ssqlite3AtoF()\sso\sthat\sit\sreports\sif\sthe\sinput\nincludes\smore\sthan\s19.25\ssignificant\sdigits. +D 2026-03-26T18:19:47.798 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea @@ -798,7 +798,7 @@ F src/trigger.c 4bf3bfb3851d165e4404a9f9e69357345f3f7103378c07e07139fdd8aeb7bd20 F src/update.c 3e5e7ff66fa19ebe4d1b113d480639a24cc1175adbefabbd1a948a07f28e37cf F src/upsert.c 215328c3f91623c520ec8672c44323553f12caeb4f01b1090ebdca99fdf7b4f1 F src/utf.c 7267c3fb9e2467020507601af3354c2446c61f444387e094c779dccd5ca62165 -F src/util.c 363fb8548ac2f321b01de1d2847d4492a5dd8932c61961fe555eb779093b52c5 +F src/util.c c24ed5647e81eea3abe3d9878b709425a3e843cbf4580ac442ed46b93824138c F src/vacuum.c d3d35d8ae893d419ade5fa196d761a83bddcbb62137a1a157ae751ef38b26e82 F src/vdbe.c 6c57525d7db0232d52687d30da1093db0c152f14206c2ef1adf0c19a09d863e3 F src/vdbe.h 70e862ac8a11b590f8c1eaac17a0078429d42bc4ea3f757a9af0f451dd966a71 @@ -2195,8 +2195,8 @@ F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee F tool/warnings.sh a554d13f6e5cf3760f041b87939e3d616ec6961859c3245e8ef701d1eafc2ca2 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f F tool/winmain.c 00c8fb88e365c9017db14c73d3c78af62194d9644feaf60e220ab0f411f3604c -P 97ee48b6ef65fb55633196282c9e75b3b0a3b81ba9755f63493a38e3f1a5610c -R ddd719e3f218d9b203be0a8d1b14da98 +P f10a431eade20ecd4c4d501fc534e2dae6ab2fe67302ea7bb3cd6eba127848fc +R 4139a25aa4935eba434b566008569a3a U drh -Z e90bb32a1cf83cea1813c00b1f84eb7b +Z 8dd56ad9f62803942b771c0cbac20574 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e702f74828..572065a570 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -f10a431eade20ecd4c4d501fc534e2dae6ab2fe67302ea7bb3cd6eba127848fc +1721c8da769816ca16104cd636299d84f682fc004938a50056b76b269e49e915 diff --git a/src/util.c b/src/util.c index b4e7031cb3..18c2e127b3 100644 --- a/src/util.c +++ b/src/util.c @@ -828,6 +828,7 @@ static double sqlite3Fp10Convert2(u64 d, int p){ ** This bit is zero if the input is an integer ** bit 2 => The input is exactly 0.0, not an underflow from ** some value near zero +** bit 3 => More than 19 significant digits in the input ** ** If the input contains a syntax error but begins with text that might ** be a valid number of some kind, then the result is negative. The @@ -873,7 +874,8 @@ int sqlite3AtoF(const char *zIn, double *pResult){ while( (v = (unsigned)z[0] - '0')<10 ){ s = s*10 + v; z++; - if( s>=(LARGEST_INT64-9)/10 ){ + if( s>=(LARGEST_UINT64-9)/10 ){ + mState = 9; while( sqlite3Isdigit(z[0]) ){ z++; d++; } break; } @@ -898,12 +900,13 @@ int sqlite3AtoF(const char *zIn, double *pResult){ if( sqlite3Isdigit(z[0]) ){ mState |= 1; do{ - if( s<((LARGEST_INT64-9)/10) ){ + if( s<(LARGEST_UINT64-9)/10 ){ s = s*10 + z[0] - '0'; d--; + }else{ + mState = 11; } - z++; - }while( sqlite3Isdigit(z[0]) ); + }while( sqlite3Isdigit(*++z) ); }else if( mState==0 ){ *pResult = 0.0; return 0;