dstlen < 0 for MultiByteToWideChar / WideChatToMultiByte

Michael Stefaniuc mstefani at redhat.com
Wed Sep 16 17:43:00 CDT 2009

Hello Detlef,

although Smatch could have handled the task too of finding places where 
Wine passes -1 as destlen to MultiByteToWideChar / WideChatToMultiByte 
this can be done with the C compiler too. Please see the attached patch.

This solution doesn't finds more occurrences that you have found and 
patched already. But this is really only the stuff that the compiler can 
figure out at compile time. It has no chance at all to catch stuff like

void foo(int bar)
     int dstlen = -1;

     if (bar)
         dstlen = 10;

     MultiByteToWideChar(a, b, c, d, e, dstlen)

Those can't be found by a grep either and I think that's why Alexandre 
is reluctant to apply your patches.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: dstlen.diff
Type: text/x-patch
Size: 1852 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20090917/8bb0ec25/attachment.bin>

More information about the wine-devel mailing list