-
Notifications
You must be signed in to change notification settings - Fork 264
Validate addresses before calling DAC to avoid crashes on older runtimes #1380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -295,6 +295,12 @@ public string GetFrameName(ulong vtable) | |
|
|
||
| public HResult GetFieldInfo(ulong mt, out MethodTableFieldInfo data) | ||
| { | ||
| if (mt == 0) | ||
| { | ||
| data = default; | ||
| return HResult.E_INVALIDARG; | ||
| } | ||
|
|
||
| return VTable.GetMethodTableFieldData(Self, mt, out data); | ||
| } | ||
|
|
||
|
|
@@ -420,6 +426,11 @@ public HResult GetAppDomainData(ulong addr, out AppDomainData data) | |
|
|
||
| public string? GetAppDomainName(ulong appDomain) | ||
| { | ||
| if (appDomain == 0) | ||
| { | ||
| return null; | ||
| } | ||
|
|
||
| return GetString(VTable.GetAppDomainName, appDomain); | ||
| } | ||
|
|
||
|
|
@@ -436,7 +447,7 @@ public HResult GetAppDomainStoreData(out AppDomainStoreData data) | |
| public HResult GetMethodTableData(ulong addr, out MethodTableData data) | ||
| { | ||
| // If the 2nd bit is set it means addr is actually a TypeHandle (which GetMethodTable does not support). | ||
| if ((addr & 2) == 2) | ||
| if (addr == 0 || (addr & 2) == 2) | ||
| { | ||
| data = default; | ||
| return HResult.E_INVALIDARG; | ||
|
|
@@ -662,6 +673,9 @@ public enum ModuleMapTraverseKind | |
|
|
||
| public HResult TraverseModuleMap(ModuleMapTraverseKind mt, ulong module, ModuleMapTraverse traverse) | ||
| { | ||
| if (module == 0) | ||
| return HResult.E_INVALIDARG; | ||
|
Comment on lines
+676
to
+677
|
||
|
|
||
| HResult hr = VTable.TraverseModuleMap(Self, mt, module, Marshal.GetFunctionPointerForDelegate(traverse), IntPtr.Zero); | ||
| GC.KeepAlive(traverse); | ||
| return hr; | ||
|
|
@@ -688,6 +702,9 @@ public enum VCSHeapType | |
|
|
||
| public HResult TraverseStubHeap(ulong heap, VCSHeapType type, LoaderHeapTraverse callback) | ||
| { | ||
| if (heap == 0) | ||
| return HResult.E_INVALIDARG; | ||
|
Comment on lines
+705
to
+706
|
||
|
|
||
| HResult hr = VTable.TraverseVirtCallStubHeap(Self, heap, type, Marshal.GetFunctionPointerForDelegate(callback)); | ||
| GC.KeepAlive(callback); | ||
| return hr; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.