weixin_39817347 2020-11-29 13:27
浏览 0

non-ascii strings in DR API (was "ASSERT((unsigned short)(*wstr) <= UCHAR_MAX) in our_vsnprintf")

From zhao....com 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

该提问来源于开源项目:DynamoRIO/dynamorio

  • 写回答

22条回答 默认 最新

  • weixin_39817347 2020-11-29 13:27
    关注

    From bruen....com on October 09, 2012 14:00:20

    what is being printed? (paste the callstack)

    评论

报告相同问题?