Lei Zhang : comctl32: Check for NULL input in TAB_AdjustRect.

Alexandre Julliard julliard at winehq.org
Tue Nov 11 08:35:37 CST 2008


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

Author: Lei Zhang <thestig at google.com>
Date:   Mon Nov 10 20:39:29 2008 -0800

comctl32: Check for NULL input in TAB_AdjustRect.

---

 dlls/comctl32/tab.c       |    2 ++
 dlls/comctl32/tests/tab.c |   18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c
index 0afcc77..6a9b8e8 100644
--- a/dlls/comctl32/tab.c
+++ b/dlls/comctl32/tab.c
@@ -863,6 +863,8 @@ static LRESULT TAB_AdjustRect(const TAB_INFO *infoPtr, WPARAM fLarger, LPRECT pr
     TRACE ("hwnd=%p fLarger=%ld (%s)\n", infoPtr->hwnd, fLarger,
            wine_dbgstr_rect(prc));
 
+    if (!prc) return -1;
+
     if(lStyle & TCS_VERTICAL)
     {
 	iRightBottom = &(prc->right);
diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c
index bd4919d..9d98e11 100644
--- a/dlls/comctl32/tests/tab.c
+++ b/dlls/comctl32/tests/tab.c
@@ -856,6 +856,22 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs)
     DestroyWindow(hTab);
 }
 
+static void test_adjustrect(HWND parent_wnd)
+{
+    HWND hTab;
+    INT r;
+
+    ok(parent_wnd != NULL, "no parent window!\n");
+
+    hTab = createFilledTabControl(parent_wnd, TCS_FIXEDWIDTH, 0, 0);
+    ok(hTab != NULL, "Failed to create tab control\n");
+
+    r = SendMessage(hTab, TCM_ADJUSTRECT, FALSE, 0);
+    expect(-1, r);
+
+    r = SendMessage(hTab, TCM_ADJUSTRECT, TRUE, 0);
+    expect(-1, r);
+}
 static void test_insert_focus(HWND parent_wnd)
 {
     HWND hTab;
@@ -1001,6 +1017,8 @@ START_TEST(tab)
     /* Testing getters and setters with 5 tabs */
     test_getters_setters(parent_wnd, 5);
 
+    test_adjustrect(parent_wnd);
+
     test_insert_focus(parent_wnd);
     test_delete_focus(parent_wnd);
 




More information about the wine-cvs mailing list