Merge pull request #5636 from BrzVlad/fix-xmm-scan
[mono.git] / mcs / class / Mono.Profiler.Log / Mono.Profiler.Log / LogStreamHeader.cs
index b8eb4413fd7884dfbd6409a8a5d38def590d5bcb..44575028a7a38613d59d698f2c282e06d4ff6100 100644 (file)
@@ -7,6 +7,9 @@ using System;
 namespace Mono.Profiler.Log {
 
        public sealed class LogStreamHeader {
+               
+               const int MinVersion = 13;
+               const int MaxVersion = 14;
 
                const int Id = 0x4d505a01;
 
@@ -41,6 +44,10 @@ namespace Mono.Profiler.Log {
 
                        Version = new Version (reader.ReadByte (), reader.ReadByte ());
                        FormatVersion = reader.ReadByte ();
+
+                       if (FormatVersion < MinVersion || FormatVersion > MaxVersion)
+                               throw new LogException ($"Unsupported MLPD version {FormatVersion}. Should be >= {MinVersion} and <= {MaxVersion}.");
+                       
                        PointerSize = reader.ReadByte ();
                        StartupTime = reader.ReadUInt64 ();
                        TimerOverhead = reader.ReadInt32 ();