Ulrich Czekalla : oleaut32: Prevent freeing of random memory.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Feb 2 07:09:13 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 37f1d4cb54d568bdb3bdc5a00752e62419628d67
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=37f1d4cb54d568bdb3bdc5a00752e62419628d67

Author: Ulrich Czekalla <ulrich at codeweavers.com>
Date:   Thu Feb  2 13:18:43 2006 +0100

oleaut32: Prevent freeing of random memory.
Don't assign type to variant until we're sure we are assigning a
value.

---

 dlls/oleaut32/variant.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/variant.c b/dlls/oleaut32/variant.c
index 4a2dd90..a40f3d0 100644
--- a/dlls/oleaut32/variant.c
+++ b/dlls/oleaut32/variant.c
@@ -2952,7 +2952,6 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LP
 
     /* Do the math */
     hres = S_OK;
-    V_VT(&tv) = tvt;
     V_VT(result) = resvt;
     switch (tvt) {
         case VT_DECIMAL:
@@ -2973,10 +2972,13 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LP
                 V_VT(result) = VT_R8;
                 V_R8(result) = r8res;
                 goto end;
-            } else
+            } else {
+                V_VT(&tv) = tvt;
                 V_I8(&tv) = V_I8(&lv) + V_I8(&rv);
+            }
             break;
         case VT_R8:
+            V_VT(&tv) = tvt;
             /* FIXME: overflow detection */
             V_R8(&tv) = V_R8(&lv) + V_R8(&rv);
             break;




More information about the wine-cvs mailing list