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:
10
src/util.c
10
src/util.c
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user