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

Fix additional cases of possible signed integer overflow, especially with

regard to negation.

FossilOrigin-Name: 2d5800bd8cfc7d7f5578a71b1aeaa74b2ec4b372
This commit is contained in:
drh
2011-03-08 02:38:28 +00:00
parent 2327275b8c
commit d50ffc416f
9 changed files with 45 additions and 37 deletions

View File

@@ -1138,3 +1138,13 @@ int sqlite3MulInt64(i64 *pA, i64 iB){
*pA = r;
return 0;
}
/*
** Compute the absolute value of a 32-bit signed integer, of possible. Or
** if the integer has a value of -2147483648, return +2147483647
*/
int sqlite3AbsInt32(int x){
if( x>=0 ) return x;
if( x==0x80000000 ) return 0x7fffffff;
return -x;
}