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

Fix two potential (and apparently harmless) shift overflows discovered by

the -fcatch-undefined-behavior option of clang.

FossilOrigin-Name: e19eead8c9977ed4f00eac54c5bc7e90db78caa8
This commit is contained in:
drh
2013-12-05 16:41:55 +00:00
parent 7f59475fda
commit 47676fedf6
4 changed files with 12 additions and 10 deletions

View File

@@ -1281,6 +1281,8 @@ u64 sqlite3LogEstToInt(LogEst x){
x /= 10;
if( n>=5 ) n -= 2;
else if( n>=1 ) n -= 1;
if( x>=3 ) return (n+8)<<(x-3);
if( x>=3 ){
return x>60 ? (u64)LARGEST_INT64 : (n+8)<<(x-3);
}
return (n+8)>>(3-x);
}