mirror of
https://github.com/sqlite/sqlite.git
synced 2025-10-21 11:13:54 +03:00
Make the sum() function less precise and slower in order to avoid
harmless signed integer overflow UBSAN warnings from OSS-Fuzz. FossilOrigin-Name: 1be0646a2c352dbf03d2af87fd48b6f9edfd68666790ac6863144ac95f3e0621
This commit is contained in:
@@ -1740,8 +1740,13 @@ static void sumFinalize(sqlite3_context *context){
|
||||
if( p->approx ){
|
||||
sqlite3_result_double(context, p->rSum[0]+p->rSum[1]);
|
||||
}else{
|
||||
i64 v = (i64)p->rSum[0] + (i64)p->rSum[1];
|
||||
double r = p->rSum[0] + p->rSum[1];
|
||||
i64 v;
|
||||
double y[2], z[2];
|
||||
v = sqlite3RealToI64(p->rSum[0]);
|
||||
if( sqlite3AddInt64(&v, sqlite3RealToI64(p->rSum[1])) ){
|
||||
v = 0;
|
||||
}
|
||||
sqlite3DDFromInt(v, y);
|
||||
sqlite3DDSub(y[0], y[1], p->rSum[0], p->rSum[1], z);
|
||||
if( z[0] + z[1] != 0.0 ){
|
||||
|
Reference in New Issue
Block a user