OLEAUT: Prevent freeing of random memory
Ulrich Czekalla
ulrich.czekalla at utoronto.ca
Wed Feb 1 09:39:50 CST 2006
ChangeLog:
Ulrich Czekalla <ulrich at codeweavers.com>
Don't assign type to variant until we're sure we are assigning a value.
Prevents freeing of random memory.
-------------- next part --------------
Subject: [PATCH] Wait to assign type until we assign an actual value
---
dlls/oleaut32/variant.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
38d8e402623696fe08fb6af977f63fe1a6c71979
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;
--
1.0.6
More information about the wine-patches
mailing list