[PATCH v4 1/5] ole32: Add support for loading enhmetafiles from presentation and contents streams to data cache.

Dmitry Timoshkov dmitry at baikal.ru
Thu Apr 5 21:32:52 CDT 2018


Sergio Gómez Del Real <sdelreal at codeweavers.com> wrote:

> +        DWORD size_bits;
> +        ULONG read;

Why not have them both assign same type ULONG?

> +
> +        hr = IStream_Stat( stm, &stat, STATFLAG_NONAME );
> +
> +        if (SUCCEEDED( hr ))
> +        {
> +            data = HeapAlloc( GetProcessHeap(), 0, stat.cbSize.u.LowPart );
> +            if (!data) return E_OUTOFMEMORY;
> +
> +            hr = IStream_Read( stm, data, stat.cbSize.u.LowPart, &read );
> +            if (hr != S_OK || read != stat.cbSize.u.LowPart)
> +            {

IStream_Read() never returns S_OK for short reads.

> +                HeapFree( GetProcessHeap(), 0, data );
> +                return E_FAIL;
> +            }
> +
> +            size_bits = read - sizeof(DWORD) - sizeof(ENHMETAHEADER);
> +            if (size_bits <= 0)
> +            {

size_bits is an unsigned, so the condition above is not correct.

-- 
Dmitry.



More information about the wine-devel mailing list