Am 26.01.2011 17:24, schrieb Nikolay Sivov:
> On 1/26/2011 19:16, André Hentschel wrote:
>> http://austinenglish.com/logs/valgrind/2011-01-25-11.02/vg-gameux_gamestatistics.txt
>>
>> native returns S_OK, but NULL for the title when the category is not 
>> available
>> see also 
>> http://source.winehq.org/git/wine.git/?a=blob;f=dlls/gameux/tests/gamestatistics.c;h=5bae4c8fb3cf3a013c908927ef895b07daafe548;hb=HEAD#l365
>>
>> That should also fix the crash in 
>> http://test.winehq.org/data/72e089d6009b524c68e9996d7c6e042c3f86cd69/wine_ss-ku1010-win32-heap/gameux:gamestatistics.html
>> ---
>>   dlls/gameux/gamestatistics.c |    2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/dlls/gameux/gamestatistics.c b/dlls/gameux/gamestatistics.c
>> index c96fb6d..7ad5e52 100644
>> --- a/dlls/gameux/gamestatistics.c
>> +++ b/dlls/gameux/gamestatistics.c
>> @@ -826,7 +826,7 @@ static HRESULT WINAPI 
>> GameStatisticsImpl_GetCategoryTitle(
>>           hr = E_INVALIDARG;
>>
>>
>> -    if(SUCCEEDED(hr))
>> +    if(SUCCEEDED(hr)&&  This->stats.categories[categoryIndex].sName)
>>       {
>>           nLength = lstrlenW(This->stats.categories[categoryIndex].sName);
>>           if(nLength != 0)
> Er, what does it change? NULL sName doesn't produce zero length?

lstrlenW(NULL) crashes as it seems.
So sName can be NULL as it's a String

> Also what looks strange is few lines before that:
> 
> ---
>     *pTitle = NULL;
> 
>     if(!pTitle || categoryIndex >= MAX_CATEGORIES)
>         hr = E_INVALIDARG;
> ---

true, fixed in try2

> The whole method should be fixed/cleaned:
> - return earlier on invalid arguments;
> - remove hr as it's useless;
> - remove dereference before a check.
> 


-- 

Best Regards, André Hentschel


Reply via email to