-C Add\sa\sTODO\sregarding\sreplacing\sthe\sinternal\ssqlite3__wasm_db_error()\swith\sthe\snew\s[34eda113c8819d\s|\ssqlite3_set_errmsg()],\swhich\sserves\sthe\ssame\srole.
-D 2025-09-12T17:36:23.257
+C Enhance\sthe\sintegerValue()\sroutine\sin\sthe\sCLI\sso\sthat\swhen\sits\stext\sinput\nspecifies\san\sout-of-range\sinteger,\sthe\sroutine\sreturns\sthe\snearest\sinteger\nthat\sis\srepresentable\sas\s64-bit\stwos-complement.
+D 2025-09-13T17:53:14.695
F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F src/resolve.c f8d1d011aba0964ff1bdccd049d4d2c2fec217efd90d202a4bb775e926b2c25d
F src/rowset.c 8432130e6c344b3401a8874c3cb49fefe6873fec593294de077afea2dce5ec97
F src/select.c b95181711d59c36d9789e67f76c4cfec64b99f9629a50be5e6566e117b87d957
-F src/shell.c.in c309e6e95b4de2be9dd0fbe4d40f729199a85bcc54d66759a0aef3b3e6504b22
+F src/shell.c.in 694e67b4d8c09a27b5d55696973b0511974a9337906222006529989e40218156
F src/sqlite.h.in 5732519a2acb09066032ceac21f25996eb3f28f807a4468e30633c7c70faae1c
F src/sqlite3.rc 015537e6ac1eec6c7050e17b616c2ffe6f70fca241835a84a4f0d5937383c479
F src/sqlite3ext.h 3f0c4ed6934e7309a61c6f3c30f70a30a5b869f785bb3d9f721a36c5e4359126
F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
F tool/warnings.sh 1ad0169b022b280bcaaf94a7fa231591be96b514230ab5c98fbf15cd7df842dd
F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P e34eda113c8819df46c139ccf749b686c8bfdd399f59345c6d6be3736bdf97cb
-R 7ce068fa579e2511d000a3c5b6dbc6d3
-U stephan
-Z 7547c1657724e40779150571322f7ca2
+P ead8a3a94e0f349bcdced6a62af0349b0b7b731137c8d33e2ef0e7eecd107c1f
+R b1fa16bbc1f849c3ca9135d719410333
+U drh
+Z a6d11ba07cbae9bdd6ab42dfdcc5fd47
# Remove this line to create a well-formed Fossil manifest.
/*
** Interpret zArg as an integer value, possibly with suffixes.
+**
+** If the value specified by zArg is outside the range of values that
+** can be represented using a 64-bit twos-complement integer, then return
+** the nearest representable value.
*/
static sqlite3_int64 integerValue(const char *zArg){
- sqlite3_int64 v = 0;
- static const struct { char *zSuffix; int iMult; } aMult[] = {
+ sqlite3_uint64 v = 0;
+ static const struct { char *zSuffix; unsigned int iMult; } aMult[] = {
{ "KiB", 1024 },
{ "MiB", 1024*1024 },
{ "GiB", 1024*1024*1024 },
int x;
zArg += 2;
while( (x = hexDigitValue(zArg[0]))>=0 ){
+ if( v > 0x0fffffffffffffffULL ) goto integer_overflow;
v = (v<<4) + x;
zArg++;
}
}else{
while( IsDigit(zArg[0]) ){
- v = v*10 + zArg[0] - '0';
+ if( v>=922337203685477580 ){
+ if( v>922337203685477580 || zArg[0]>='8' ) goto integer_overflow;
+ }
+ v = v*10 + (zArg[0] - '0');
zArg++;
}
}
for(i=0; i<ArraySize(aMult); i++){
if( sqlite3_stricmp(aMult[i].zSuffix, zArg)==0 ){
+ if( 0x7fffffffffffffffULL/aMult[i].iMult < v ) goto integer_overflow;
v *= aMult[i].iMult;
break;
}
}
- return isNeg? -v : v;
+ if( isNeg && v>0x7fffffffffffffffULL ) goto integer_overflow;
+ return isNeg? -(sqlite3_int64)v : (sqlite3_int64)v;
+integer_overflow:
+ return isNeg ? 0x8000000000000000LL : 0x7fffffffffffffffLL;
}
/*