DynamoRIO / DynamoRIO/dynamorio
non-ascii strings in DR API (was "ASSERT((unsigned short)(*wstr) <= UCHAR_MAX) in our_vsnprintf")
- Dominant language
- C
- Stars
- 3.2k
- Forks
- 629
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 30
Description
_From [zhao...@google.com](https://code.google.com/u/106321947286816917100/) on October 09, 2012 16:57:53_
~/Workspace/DynamoRIO/builds/build_x86_dbg.svn/bin32/drrun.exe -debug -ops "-msgbox_mask 0xf" -- ./unit_tests.exe --gtest_filter=IEImporterTest.IEImporter
int
TNAME(our_vsnprintf)(TCHAR *s, size_t max, const TCHAR *fmt, va_list ap)
```
/* insert the actual str representation */
if (wstr != NULL) {
while (*wstr) {
if (max > 0 && (size_t)(s - start) >= max)
goto max_reached;
if ((*c == _T('s') || *c == _T('S')) && decimal == 0)
break; /* check string precision */
decimal--;
/* we only support ascii */
ASSERT((unsigned short)(*wstr) \<= UCHAR_MAX);
*s = (TCHAR) *wstr;
s++;
wstr++;
}
} else {
```
0:000> dt wstr
Local var @ 0x17f5e8bc Type unsigned short*
0x0627c30e
-> 0x4e2d
_Original issue: http://code.google.com/p/dynamorio/issues/detail?id=943_
Breakdown of sub-tasks:
- [X] Implement UTF-8 to UTF-16 and vice versa conversion routines in the core
- [X] Use UTF-8<->UTF-16 in our_vsnprintf %S
- [X] Document in main docs and dr_sn{w,}printf headers
- [X] drsyms: switch SymLoadModule to SymLoadModuleExW
- [X] drsyms (#1085): use SymGetLineFromAddrW64
- [X] drdeploy (i#1079): GetEnvironmentVariableA, _access(), main(), etc.
- [X] drdeploy: use _tfopen()
- [X] drdeploy: _tmain
- [X] drconfiglib: GetEnvironmentVariableA, CreateDirectoryA, convert_to_tchar() needs to use MultiByteToWideChar() + need to ensure all sources are UTF-8
(for env var can just use drfront_get_env_var() nowadays)
- [X] drinjectlib: API
- [ ] injection: LoadLibraryA
- [X] drconfiglib: TSTR_FMT snprintf needs to use our_snprintf or char_to_tchar
- [ ] tolower() and its callers (strcasecmp(), strcasecmp_with_wildcards(), str_case_prefix())
- [ ] drcontainers hashtable case-insensitive hashing
- [ ] DrMem tolower() calls in text_matches_pattern() + strcasestr()
- [ ] drcov2lcov FindFirstFile
Contributor guide
Assessment
This issue has not been assessed yet.