summaryrefslogtreecommitdiff
path: root/src/md
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-01-29 05:21:44 -0800
committerGitHub <noreply@github.com>2018-01-29 05:21:44 -0800
commitae2754314ac8281dad2e1b28aa0e23566d2f4edd (patch)
treecfe0ba7f0d8e13d68d21d8f6c85b20f2a3be8149 /src/md
parente7c1f82bf588cfe6fc3c5a9147f1acbfd42614b5 (diff)
downloadcoreclr-ae2754314ac8281dad2e1b28aa0e23566d2f4edd.tar.gz
coreclr-ae2754314ac8281dad2e1b28aa0e23566d2f4edd.tar.bz2
coreclr-ae2754314ac8281dad2e1b28aa0e23566d2f4edd.zip
Fix metadata format error checking (#16036)
NextStream_Verify can return NULL for invalid file. Report error for it instead of AVing. Similar check is around the other calls to NextStream_Verify. It was missing here for some reason.
Diffstat (limited to 'src/md')
-rw-r--r--src/md/runtime/mdinternaldisp.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/md/runtime/mdinternaldisp.cpp b/src/md/runtime/mdinternaldisp.cpp
index e6e25a2110..6498b359c0 100644
--- a/src/md/runtime/mdinternaldisp.cpp
+++ b/src/md/runtime/mdinternaldisp.cpp
@@ -74,6 +74,11 @@ CheckFileFormat(
}
// Get next stream.
PSTORAGESTREAM pNext = pStream->NextStream_Verify();
+ if (pNext == NULL)
+ { // Stream header is corrupted.
+ Debug_ReportError("Invalid stream header - cannot get next stream header.");
+ IfFailGo(CLDB_E_FILE_CORRUPT);
+ }
// Check that stream header is within the buffer.
if (((LPBYTE)pStream >= ((LPBYTE)pData + cbData)) ||