Author: mturk
Date: Sun Aug 16 07:45:11 2009
New Revision: 804642
URL: http://svn.apache.org/viewvc?rev=804642&view=rev
Log:
Fail on invalid UTF8 sequence
Modified:
commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c
Modified: commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c
URL:
http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c?rev=804642&r1=804641&r2=804642&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c (original)
+++ commons/sandbox/runtime/trunk/src/main/native/os/win32/wutil.c Sun Aug 16
07:45:11 2009
@@ -107,7 +107,8 @@
t += 8;
}
}
- if (!MultiByteToWideChar(CP_UTF8, 0, srcstr, -1, t, retlen))
+ if (!MultiByteToWideChar(CP_UTF8, MB_PRECOMPOSED | MB_ERR_INVALID_CHARS,
+ srcstr, -1, t, retlen))
return ACR_GET_OS_ERROR();
for (; *t; t++) {
if (*t == L'/')
@@ -141,8 +142,7 @@
}
}
- if (!WideCharToMultiByte(CP_UTF8, 0, srcstr, -1,
- retstr, retlen, NULL, 0))
+ if (!WideCharToMultiByte(CP_UTF8, 0, srcstr, -1, retstr, retlen, NULL, 0))
return ACR_GET_OS_ERROR();
for (; *retstr; retstr++) {
if (*retstr == '/')