[1/2] version: zero pad section up to virtual size

Alexandre Julliard julliard at winehq.org
Thu Nov 11 06:11:14 CST 2010


Ričardas Barkauskas <miegalius at gmail.com> writes:

> @@ -282,8 +282,12 @@ static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff )
>      }
>  
>      /* Read in resource section */
> -    resSectionSize = sections[i].SizeOfRawData;
> -    resSection = HeapAlloc( GetProcessHeap(), 0, resSectionSize );
> +    if ( sections[i].SizeOfRawData < sections[i].Misc.VirtualSize )
> +        resSectionSize = sections[i].SizeOfRawData;
> +    else
> +        resSectionSize = sections[i].Misc.VirtualSize;
> +
> +    resSection = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sections[i].Misc.VirtualSize );

That won't work, the data won't be zero since you'll be reading from the
filepast the end of the section.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list