We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 770af05 commit d7bad19Copy full SHA for d7bad19
src/CLR/Core/CLR_RT_HeapBlock_Array.cpp
@@ -322,6 +322,20 @@ HRESULT CLR_RT_HeapBlock_Array::Copy(
322
dataSrc += indexSrc * sizeElem;
323
dataDst += indexDst * sizeElem;
324
325
+#if !defined(BUILD_RTM)
326
+ // Validate pointers and memory ranges
327
+ if (dataSrc == nullptr || dataDst == nullptr ||
328
+ dataSrc + length * sizeElem > arraySrc->GetFirstElement() + arraySrc->m_numOfElements * sizeElem ||
329
+ dataDst + length * sizeElem > arrayDst->GetFirstElement() + arrayDst->m_numOfElements * sizeElem)
330
+ {
331
+#ifdef DEBUG
332
+ _ASSERTE(FALSE);
333
+#endif
334
+
335
+ NANOCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
336
+ }
337
338
339
if (!arraySrc->m_fReference)
340
{
341
memmove(dataDst, dataSrc, length * sizeElem);
0 commit comments