Nikolay Sivov : comctl32/tab: Fix invalid read of item data.

Alexandre Julliard julliard at winehq.org
Mon Apr 11 13:29:27 CDT 2011


Module: wine
Branch: master
Commit: 6867735e20e7d6615d77eabb10f79c296a778bd6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6867735e20e7d6615d77eabb10f79c296a778bd6

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Apr  9 19:39:45 2011 +0400

comctl32/tab: Fix invalid read of item data.

---

 dlls/comctl32/tab.c       |    2 +-
 dlls/comctl32/tests/tab.c |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index fe82d59..f86fd0f 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -2500,7 +2500,7 @@ static void TAB_EnsureSelectionVisible(
 
   if (infoPtr->leftmostVisible >= iSelected)
   {
-    infoPtr->leftmostVisible = iSelected;
+    if (iSelected >= 0) infoPtr->leftmostVisible = iSelected;
   }
   else
   {
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index 4c464e6..5bd2ea0 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -1052,6 +1052,9 @@ static void test_insert_focus(HWND parent_wnd)
     hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, mask, 0);
     ok(hTab != NULL, "Failed to create tab control\n");
 
+    r = SendMessage(hTab, TCM_GETCURSEL, 0, 0);
+    expect(-1, r);
+
     flush_sequences(sequences, NUM_MSG_SEQUENCES);
 
     nTabsRetrieved = SendMessage(hTab, TCM_GETITEMCOUNT, 0, 0);




More information about the wine-cvs mailing list