mlang/tests: don't assume output of ConvertStringFromUnicode is null terminated

James Hawkins truiken at
Sun Jul 6 12:29:29 CDT 2008

2008/7/6 Dan Kegel <dank at>:
> The mlang test assumed that the output of ConvertStringFromUnicode
> was null terminated, but it seems not to be.
> Fixes the valgrind warning:
> Conditional jump or move depends on uninitialised value(s)
>   at strlen (mc_replace_strmem.c:242)
>   by lstrlenA (string.c:364)
>   by ConvertINetMultiByteToUnicode (mlang.c:526)
>   by ConvertINetString (mlang.c:633)
>   by fnIMultiLanguage2_ConvertString (mlang.c:2197)
>   by check_convertible (mlang.c:287)
>   by test_EnumCodePages (mlang.c:407)
>  Uninitialised value was created by a stack allocation
>   at check_convertible (mlang.c:270)
> I believe James was trying to fix this with
> but missed (he thought the problem was on the destination
> len, but really it was on the source len?).

No, this is hiding a bug.  The test code conforms with the API.  The
problem is that ConvertINetMultiByteToUnicode uses the value of an
out-only parameter (NULL pDstStr, non-NULL pcDstSize).  Check out the
code block in mlang.c:632.

James Hawkins

More information about the wine-devel mailing list