Handle multidimensional arrays
authorAndrey Kvochko <a.kvochko@samsung.com>
Fri, 15 Sep 2017 19:34:04 +0000 (22:34 +0300)
committerRuben Ayrapetyan <r.ayrapetyan@samsung.com>
Fri, 15 Sep 2017 19:33:08 +0000 (22:33 +0300)
profiler/profiler/src/profiler.cpp

index 2e5240b..d43ea23 100644 (file)
@@ -221,10 +221,11 @@ static HRESULT GetClassNameFromClassId(ICorProfilerInfo *info, ClassID classId,
         return hr;
 
       size_t namelen = wcslen(wszClass);
-      if (namelen >= MAX_NAME_LENGTH - 2)
+      if (namelen >= MAX_NAME_LENGTH - 2 * cRank)
         return S_FALSE;
-
-      StringCchCopyW(wszClass + namelen, 3, W("[]"));
+      
+      for (int i = 0; i < cRank; ++i, namelen += 2)
+        StringCchCopyW(wszClass + namelen, 3, W("[]"));
 
       return S_OK;
     }