1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-10-21 11:13:54 +03:00

When casting string values into numeric and the string has a prefix that looks

like a number but total string is not a well-formed number, then take extra
care that the result is either integer or real depending on what the prefix
looks like.  Fix for tickets [e8bedb2a184001] and [4c2d7639f076aa].

FossilOrigin-Name: 67a68af5578f08d2be2e48cf4fd12a6cf35a09c47d259deda81950f7ee1f02f7
This commit is contained in:
drh
2019-06-07 22:26:08 +00:00
parent 4eefeb5577
commit 9a2782293c
10 changed files with 93 additions and 53 deletions

View File

@@ -397,7 +397,7 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
sqlite3_result_error_nomem(context);
return;
}
if( !sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8) ){
if( sqlite3AtoF(zBuf, &r, sqlite3Strlen30(zBuf), SQLITE_UTF8)<=0 ){
assert( sqlite3_strglob("*Inf", zBuf)==0 );
r = zBuf[0]=='-' ? -HUGE_VAL : +HUGE_VAL;
}