[Fwd: OLEAUT32: VARIANT parsing of hex/octal integer string must not negate value]

Alex Villaci­s Lasso a_villacis at palosanto.com
Thu Jan 13 16:45:43 CST 2005


Apparently this patch did not make it in time for the 20050111 release, 
so I am resending it.

Alex Villaci­s Lasso escribió:

> This patch was originally to fix a bug in which Visual Basic 6 
> attempts to parse the following statement:
>
>    Dim someValue As Long = &H80000002
>
> by feeding it to the VARIANT parsing routines. The purpose of the 
> previous statement is to build a 32-bit signed value whose bit pattern 
> is 0x80000002. This succeeds in Windows, but fails in Wine with an 
> overflow, which is reported to the VB6 user as a "parse error". Upon 
> examination of dlls/oleaut32/variant.c, I realized that there is a 
> verification of upper and lower bounds before assigning the VT_I4 
> value. However, this check is incorrect in at least two places:
>
> * The check for a valid VT_I4 fails for the hex pattern shown above, 
> because the value, if interpreted as unsigned, requires more than 32 
> bits, but the negated value in 64 bits does not pass the I4_MIN test 
> either.
> * Even if the test succeeded, the programmer's intent was to build an 
> integer with a specific bit pattern. This intent is broken when the 
> VARIANT routines assign a negated value rather than the specified bit 
> pattern.
>
> The attached patch allows Visual Basic to parse the example statement 
> successfully with the builtin oleaut32.
> Please inform whether this patch is adequate or not. If not adequate, 
> please explain the rationale behind the old behavior.
>
> PS: I have left in place the R_4 and R_8 conversions, since I don't 
> know whether there is any program which specifies an hex/octal bit 
> pattern for a floating-point value.
>
> Changelog:
> * When parsing an hex/oct integer value, copy value verbatim in 
> VARIANT, rather than a negated value
>

-------------- next part --------------
An embedded message was scrubbed...
From: =?ISO-8859-1?Q?Alex_Villaci=ADs_Lasso?= <a_villacis at palosanto.com>
Subject: OLEAUT32: VARIANT parsing of hex/octal integer string must not negate
 value
Date: Mon, 10 Jan 2005 10:52:01 -0500
Size: 4810
Url: http://www.winehq.org/pipermail/wine-patches/attachments/20050113/49345f30/octalintegerstringmustnotnegatevalue.mht


More information about the wine-patches mailing list