Tabbar::GetTabBar(): bounds-checking implemented. (#121)

This commit is contained in:
İsmail Yılmaz 2022-12-24 15:34:15 +03:00 committed by GitHub
parent 861b26d694
commit 58cfe3a9c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2234,6 +2234,10 @@ int TabBar::GetTargetTab(Point p)
int f = GetFirst();
int l = GetLast();
int n = tabs.GetCount();
if(f < 0 || f >= n || l < 0 || l >= n)
return -1;
if(tabs[f].visible && p.x < tabs[f].pos.x + tabs[f].size.cx / 2)
return f;
@ -2251,9 +2255,9 @@ int TabBar::GetTargetTab(Point p)
l = FindStackHead(tabs[l].stack);
if(t == l)
t = tabs.GetCount();
t = n;
else
t = GetNext(t);
t = GetNext(t);
return t;
}