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

James Hawkins truiken at
Mon Jul 7 15:37:14 CDT 2008

On Mon, Jul 7, 2008 at 12:08 AM, Dan Kegel <dank at> wrote:
> On Sun, Jul 6, 2008 at 10:29 AM, James Hawkins <truiken at> wrote:
>> 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.
> Yeah, that's what I figured you thought, but your fix
> doesn't actually get rid of the error message,
> and the error is happening on
>            *pcSrcSize = lstrlenA(pSrcStr);
> in ConvertINetMultiByteToUnicode.
> The conformance test shows on line 197 that
> IMultiLanguage2_ConvertStringFromUnicode
> doesn't null-terminate its output.  So it's wrong for
> check_convertible to rely on it to do so.
> Am I missing something?  I still believe in my patch...

The thing that's wrong with your patch is that you're mixing source
size and dest size, which aren't necessarily similar values depending
on code page.  The right fix is to make sure the NULL terminator is
encoded too in the first conversion.  I also fixed up
ConvertINetMultiByteToUnicode while I was at it (accessing out-only

James Hawkins

More information about the wine-devel mailing list