[Bug 32582] New: WideCharToMultiByte: incorrectly handling of user specified DBCS "default character"

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Dec 28 21:30:51 CST 2012


http://bugs.winehq.org/show_bug.cgi?id=32582

             Bug #: 32582
           Summary: WideCharToMultiByte: incorrectly handling of user
                    specified DBCS "default character"
           Product: Wine
           Version: 1.5.20
          Platform: x86
        OS/Version: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: kernel32
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: thtfpcuser at 126.com
    Classification: Unclassified


for function WideCharToMultiByte, 

when there are unmapped uncode characters in target codepage, 

and the user specified lpDefaultChar is DBCS character, 

the default characters occured in conversion result is incorrect.

the problem is in this function:

wctomb.c

  /* slow version of wcstombs_dbcs that handles the various flags */
static int wcstombs_dbcs_slow( const struct dbcs_table *table, int flags,
                               const WCHAR *src, unsigned int srclen,
                               char *dst, unsigned int dstlen,
                               const char *defchar, int *used )
{
    const unsigned short * const uni2cp_low = table->uni2cp_low;
    const unsigned short * const uni2cp_high = table->uni2cp_high;
    WCHAR defchar_value = table->info.def_char;
    WCHAR composed;
    int len, tmp;
    if (defchar) defchar_value = defchar[1] ? ((defchar[0] << 8) | defchar[1])
: defchar[0];


defchar[0] has only 8 bits. left shifts 8 bits, its value is lost.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list