aboutsummaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2013-12-05 16:41:55 +0000
committerdrh <drh@noemail.net>2013-12-05 16:41:55 +0000
commit47676fedf640e2433bde647a6c3343fa2e3a64c0 (patch)
tree4032029cbffd4e3403b72d06fc376a2c027af80c /src/util.c
parent7f59475fdaac1f487f32cc3604b15a7273b73631 (diff)
downloadsqlite-47676fedf640e2433bde647a6c3343fa2e3a64c0.tar.gz
sqlite-47676fedf640e2433bde647a6c3343fa2e3a64c0.zip
Fix two potential (and apparently harmless) shift overflows discovered by
the -fcatch-undefined-behavior option of clang. FossilOrigin-Name: e19eead8c9977ed4f00eac54c5bc7e90db78caa8
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util.c b/src/util.c
index e59f5238f..9fa2a0fbd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -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);
}