diff options
author | drh <> | 2023-08-01 19:10:30 +0000 |
---|---|---|
committer | drh <> | 2023-08-01 19:10:30 +0000 |
commit | cbaef88980f48c963da8788faadd429b64d72dca (patch) | |
tree | 20b05f773eabe4b5de7a682c4f9bc5417fb2e227 /src/util.c | |
parent | 2877c43e6c08d499e52459507201190781abda42 (diff) | |
download | sqlite-cbaef88980f48c963da8788faadd429b64d72dca.tar.gz sqlite-cbaef88980f48c963da8788faadd429b64d72dca.zip |
Avoid ASAN warnings when converting over-sized long double values into double.
FossilOrigin-Name: e989a37ff9d5b52e0090d59be077ad2260c8df5d4c2c2d8088b1160de64dffd4
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c index 1200aef0e..002a5ef47 100644 --- a/src/util.c +++ b/src/util.c @@ -591,7 +591,13 @@ do_atof_calc: while( e<=-10 ){ e+=10; r *= 1.0e-10L; } while( e<=-1 ){ e+=1; r *= 1.0e-01L; } } - *pResult = r; + if( r>+1.7976931348623157081452742373e+308L ){ + *pResult = +INFINITY; + }else if( r<-1.7976931348623157081452742373e+308L ){ + *pResult = -INFINITY; + }else{ + *pResult = (double)r; + } }else{ double rr[2]; u64 s2; |