PATH: a little dll/oleaut32/tmarshal.c correction

Marcus Meissner marcus at jet.franken.de
Fri Sep 19 01:44:26 CDT 2003


On Thu, Sep 18, 2003 at 01:49:44PM +0200, Evalet Olivier wrote:
> For Marcus Meissner,
> 
> Concerning the file dll/oleaut32/tmarshal.c, I have added a check for a
> result function. Below, the modified function with (SUCCEEDED test). It
> prevent a crash in my application.
> 
> I don't no if the test: if (hres)... is writted to be equivalent of :
> if (SUCCEEDED(hres))...
> ??

No, 0 would be success in this case.

You are correct, the code is slightly wrong here. I patched it thusly:

Ciao, Marcus

Changelog:
	_nrroffuncs: Check for error before dereferencing returned pointer.

Index: tmarshal.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/tmarshal.c,v
retrieving revision 1.19
diff -u -r1.19 tmarshal.c
--- dlls/oleaut32/tmarshal.c	5 Sep 2003 23:08:33 -0000	1.19
+++ dlls/oleaut32/tmarshal.c	19 Sep 2003 06:42:24 -0000
@@ -265,10 +265,10 @@
     n=0;
     while (1) {
 	hres = ITypeInfo_GetFuncDesc(tinfo,n,&fdesc);
-	if (fdesc->oVft/4 > max)
-	    max = fdesc->oVft/4;
 	if (hres)
 	    return max+1;
+	if (fdesc->oVft/4 > max)
+	    max = fdesc->oVft/4;
 	n++;
     }
     /*NOTREACHED*/



More information about the wine-patches mailing list