diff --git a/src/coreclr/debug/daccess/daccess.cpp b/src/coreclr/debug/daccess/daccess.cpp index 44a7a651ba9bb4..f221084099aabd 100644 --- a/src/coreclr/debug/daccess/daccess.cpp +++ b/src/coreclr/debug/daccess/daccess.cpp @@ -1121,6 +1121,12 @@ SplitName::CdStartField(_In_opt_ PCWSTR fullName, if (typeHandle.IsNull()) { + if (mod == NULL) + { + status = E_INVALIDARG; + goto Fail; + } + if (typeToken == mdTypeDefNil) { if (!split->FindType(mod->GetMDImport())) diff --git a/src/coreclr/pal/src/map/virtual.cpp b/src/coreclr/pal/src/map/virtual.cpp index 3fb14cae83595c..ea7e7e52c96877 100644 --- a/src/coreclr/pal/src/map/virtual.cpp +++ b/src/coreclr/pal/src/map/virtual.cpp @@ -715,7 +715,8 @@ VIRTUALCommitMemory( TRACE( "Committing the memory now..\n"); nProtect = W32toUnixAccessControl(flProtect); - + pRetVal = (void *) StartBoundary; + #ifndef TARGET_WASM // Commit the pages if (mprotect((void *) StartBoundary, MemSize, nProtect) != 0) @@ -733,7 +734,6 @@ VIRTUALCommitMemory( } #endif - pRetVal = (void *) StartBoundary; goto done; #ifndef TARGET_WASM