[01/10] msvcr90/tests: Avoid casting away const and avoid potential overflows in comparison functions.

Andrew Nguyen anguyen at codeweavers.com
Sat Jan 15 02:56:51 CST 2011


On 01/15/2011 02:53 AM, Marcus Meissner wrote:
> On Sat, Jan 15, 2011 at 02:27:49AM -0600, Andrew Nguyen wrote:
>> ---
>>  dlls/msvcr90/tests/msvcr90.c |   27 +++++++++++++++++++++------
>>  1 files changed, 21 insertions(+), 6 deletions(-)
>>
>>
> 
>> diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
>> index 24a6517..9c07d64 100644
>> --- a/dlls/msvcr90/tests/msvcr90.c
>> +++ b/dlls/msvcr90/tests/msvcr90.c
>> @@ -446,25 +446,40 @@ static void test_wcsncat_s(void)
>>  }
>>  
>> -static __cdecl int strcomparefunc(void *context, const void *a, const void*b)
>> +static __cdecl int strcomparefunc(void *context, const void *a, const void *b)
>>  {
>> +    const char *p = a, *q = b;
>> +
>>      ok (a != b, "must never get the same pointer\n");
>>      ++*(int *) context;
>> -    return lstrcmpA(*(char**)a,*(char**)b);
>> +
>> +    return lstrcmpA(p, q);
> 
> As testbot wrote, this change is wrong. :)
> 
> should be
> const char *p = *a, *q = *b;
> I guess.
> 
> Ciao, Marcus
> 
> 

Yes, I realized as soon as I saw the results. I'll resend fixed versions.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 899 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20110115/5cbad680/attachment.pgp>


More information about the wine-devel mailing list