diff --git a/src/coreclr/pal/src/file/filetime.cpp b/src/coreclr/pal/src/file/filetime.cpp index 2500d234d8b65a..d038c9f29eb595 100644 --- a/src/coreclr/pal/src/file/filetime.cpp +++ b/src/coreclr/pal/src/file/filetime.cpp @@ -263,7 +263,13 @@ BOOL PALAPI FileTimeToSystemTime( CONST FILETIME * lpFileTime, #else /* HAVE_GMTIME_R */ UnixSystemTime = gmtime( &UnixFileTime ); #endif /* HAVE_GMTIME_R */ - + if (!UnixSystemTime) + { + ERROR( "gmtime failed.\n" ); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + /* Convert unix system time to Windows system time. */ lpSystemTime->wDay = (WORD)UnixSystemTime->tm_mday; diff --git a/src/coreclr/pal/src/thread/process.cpp b/src/coreclr/pal/src/thread/process.cpp index f9f2703cf4b23d..b23eab001cca4e 100644 --- a/src/coreclr/pal/src/thread/process.cpp +++ b/src/coreclr/pal/src/thread/process.cpp @@ -2821,6 +2821,12 @@ CorUnix::InitializeProcessCommandLine( if (lpwstrFullPath) { LPWSTR lpwstr = PAL_wcsrchr(lpwstrFullPath, '/'); + if (!lpwstr) + { + ERROR("Invalid full path\n"); + palError = ERROR_INTERNAL_ERROR; + goto exit; + } lpwstr[0] = '\0'; size_t n = PAL_wcslen(lpwstrFullPath) + 1; diff --git a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/IBC/IBCProfileParser.cs b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/IBC/IBCProfileParser.cs index b119f3bce5e4f7..dfc21b015428ea 100644 --- a/src/coreclr/tools/aot/ILCompiler.ReadyToRun/IBC/IBCProfileParser.cs +++ b/src/coreclr/tools/aot/ILCompiler.ReadyToRun/IBC/IBCProfileParser.cs @@ -414,7 +414,7 @@ private uint LookupIbcMethodToken(MetadataType methodMetadataType, uint ibcToken if (method.Name == methodName) { EcmaMethod ecmaCandidateMethod = method as EcmaMethod; - if (method == null) + if (ecmaCandidateMethod == null) continue; MetadataReader metadataReader = ecmaCandidateMethod.MetadataReader; diff --git a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs index 31e148711d8db6..4bcfe2a999fbbf 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/src/System/Configuration/MgmtConfigurationRecord.cs @@ -335,6 +335,7 @@ internal ConfigurationSection FindImmediateParentSection(ConfigurationSection se string configKey = section.SectionInformation.SectionName; SectionRecord sectionRecord = GetSectionRecord(configKey, false); + Debug.Assert(sectionRecord != null); if (sectionRecord.HasLocationInputs) { SectionInput input = sectionRecord.LastLocationInput;