From ae2754314ac8281dad2e1b28aa0e23566d2f4edd Mon Sep 17 00:00:00 2001 From: Jan Kotas Date: Mon, 29 Jan 2018 05:21:44 -0800 Subject: [PATCH] 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. --- src/md/runtime/mdinternaldisp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/md/runtime/mdinternaldisp.cpp b/src/md/runtime/mdinternaldisp.cpp index e6e25a2..6498b35 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)) || -- 2.7.4