summaryrefslogtreecommitdiff
path: root/packaging/0007-FIX-fix-No.1-missing-GetImplementedMDs.patch
blob: 8ea8b47380ec6a4e166581b1c5a98b65b972f033 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 959e95869f6897afd5c3d9ff25c07318170bfaec Mon Sep 17 00:00:00 2001
From: Gleb Balykov <g.balykov@samsung.com>
Date: Wed, 11 Apr 2018 16:10:58 +0300
Subject: [PATCH 07/32] FIX: fix No.1, missing GetImplementedMDs()

---
 src/vm/methodtablebuilder.cpp |  6 ++++--
 src/vm/securitymeta.cpp       | 11 +++++++++--
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/vm/methodtablebuilder.cpp b/src/vm/methodtablebuilder.cpp
index df31c4a..3162f7c 100644
--- a/src/vm/methodtablebuilder.cpp
+++ b/src/vm/methodtablebuilder.cpp
@@ -11909,8 +11909,10 @@ void MethodTableBuilder::VerifyInheritanceSecurity()
                 MethodImpl *pMethodImpl = pMD->GetMethodImpl();
                 for (DWORD iCurImpl = 0; iCurImpl < pMethodImpl->GetSize(); iCurImpl++)
                 {
-                    MethodDesc *pDeclMD = pMethodImpl->GetImplementedMDs()[iCurImpl];
-                    _ASSERTE(pDeclMD != NULL);
+                    RelativePointer<MethodDesc *> *pRelPtrForSlot = pMethodImpl->GetImpMDsNonNull();
+                    TADDR base = dac_cast<TADDR>(pRelPtrForSlot) + iCurImpl * sizeof(RelativePointer<MethodDesc *>);
+                    MethodDesc *pDeclMD = RelativePointer<MethodDesc *>::GetValueAtPtr(base);
+
                     // We deal with interfaces below, so don't duplicate work
                     if (!pDeclMD->IsInterface())
                     {
diff --git a/src/vm/securitymeta.cpp b/src/vm/securitymeta.cpp
index 1374d9f..3f06f05 100644
--- a/src/vm/securitymeta.cpp
+++ b/src/vm/securitymeta.cpp
@@ -771,7 +771,10 @@ MethodDesc *MethodSecurityDescriptor::MethodImplementationIterator::Current()
         _ASSERTE(m_fMethodImplIterationBegun);
         _ASSERTE(m_pMD->IsMethodImpl());
         _ASSERTE(m_iMethodImplIndex < m_pMD->GetMethodImpl()->GetSize());
-        return m_pMD->GetMethodImpl()->GetImplementedMDs()[m_iMethodImplIndex];
+
+        RelativePointer<MethodDesc *> *pRelPtrForSlot = m_pMD->GetMethodImpl()->GetImpMDsNonNull();
+        TADDR base = dac_cast<TADDR>(pRelPtrForSlot) + m_iMethodImplIndex * sizeof(RelativePointer<MethodDesc *>);
+        return RelativePointer<MethodDesc *>::GetValueAtPtr(base);
     }
 }
 
@@ -856,7 +859,11 @@ void MethodSecurityDescriptor::MethodImplementationIterator::Next()
             if (m_iMethodImplIndex < pMethodImpl->GetSize())
             {
                 // Skip over the interface MethodImpls since we already processed those
-                fFoundImpl = !pMethodImpl->GetImplementedMDs()[m_iMethodImplIndex]->IsInterface();
+                RelativePointer<MethodDesc *> *pRelPtrForSlot = pMethodImpl->GetImpMDsNonNull();
+                TADDR base = dac_cast<TADDR>(pRelPtrForSlot) + m_iMethodImplIndex * sizeof(RelativePointer<MethodDesc *>);
+                MethodDesc *pDeclMD = RelativePointer<MethodDesc *>::GetValueAtPtr(base);
+
+                fFoundImpl = !pDeclMD->IsInterface();
             }
         }
     }
-- 
2.7.4