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) ...@@ -247,16 +247,17 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem)
TRACE("(%p %d)\n", infoPtr, iItem); TRACE("(%p %d)\n", infoPtr, iItem);
if (iItem < 0) if (iItem < 0)
infoPtr->iSelected=-1; infoPtr->iSelected = -1;
else if (iItem >= infoPtr->uNumItem) else if (iItem >= infoPtr->uNumItem)
return -1; return -1;
else { else {
if (infoPtr->iSelected != iItem) { if (prevItem != iItem) {
TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED; if (prevItem != -1)
TAB_GetItem(infoPtr, prevItem)->dwState &= ~TCIS_BUTTONPRESSED;
TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED; TAB_GetItem(infoPtr, iItem)->dwState |= TCIS_BUTTONPRESSED;
infoPtr->iSelected=iItem; infoPtr->iSelected = iItem;
infoPtr->uFocus=iItem; infoPtr->uFocus = iItem;
TAB_EnsureSelectionVisible(infoPtr); TAB_EnsureSelectionVisible(infoPtr);
TAB_InvalidateTabArea(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