QWindowsLocalCodec::convertToUnicode(): Fix remaining char conversion
Prevent passing a zero argument to the cbMultiByte parameter of MultiByteToWideChar. According to the documentation this will always fail. This is triggered when calling convertToUnicode with a state having remainingChars of one and a length of one. The remaining chars will be completed and the length will be reduced to zero before the actual convert. Adding an early return after the completion to prevent calling MultiByteToWideChar with the invalid zero argument. Fixes: QTCREATORBUG-21622 Change-Id: Ic6a433dd929e97b1681583cb1b9a347afaa9a09f Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
eaf4438b35
commit
9ce4260d23
|
|
@ -83,8 +83,12 @@ QString QWindowsLocalCodec::convertToUnicode(const char *chars, int length, Conv
|
|||
len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED,
|
||||
prev, 2, wc.data(), wc.length());
|
||||
if (len) {
|
||||
prepend = true;
|
||||
sp.append(QChar(wc[0]));
|
||||
if (mblen == 1) {
|
||||
state->remainingChars = 0;
|
||||
return sp;
|
||||
}
|
||||
prepend = true;
|
||||
mb++;
|
||||
mblen--;
|
||||
wc[0] = 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue