Commit 3371ba9f authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

comctl32/tab: Fix reading out of array bounds on TCM_SETCURSEL.

parent d28eabda
......@@ -247,16 +247,17 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
TRACE("(%p %d)\n", infoPtr, iItem);
if (iItem < 0)
infoPtr->iSelected=-1;
infoPtr->iSelected = -1;
else if (iItem >= infoPtr->uNumItem)
return -1;
else {
if (infoPtr->iSelected != iItem) {
if (prevItem != iItem) {
if (prevItem != -1)
TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED;
TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED;
infoPtr->iSelected=iItem;
infoPtr->uFocus=iItem;
infoPtr->iSelected = iItem;
infoPtr->uFocus = iItem;
TAB_EnsureSelectionVisible(infoPtr);
TAB_InvalidateTabArea(infoPtr);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment