diff options
author | Rodrigo Moya <rodrigo.moya@xamarin.com> | 2017-09-08 20:36:20 +0300 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome.org> | 2017-09-14 13:49:27 +0300 |
commit | de1633042b052df25b407007d9cb772319eb1895 (patch) | |
tree | b2bd523b595296029fa66ad29e80da98cbda7bd8 /mcs/class/Mono.Profiler.Log | |
parent | 1616de091b806f822f52d70222fa431724f87846 (diff) |
[Mono.Profiler.Log] Check MLPD version when reading header
Right now, when reading a MLPD of an old version, it just silently fails, so
throw an exception when the version is unsuported.
Diffstat (limited to 'mcs/class/Mono.Profiler.Log')
-rw-r--r-- | mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs index b8eb4413fd7..494044d60ce 100644 --- a/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs +++ b/mcs/class/Mono.Profiler.Log/Mono.Profiler.Log/LogStreamHeader.cs @@ -7,6 +7,8 @@ using System; namespace Mono.Profiler.Log { public sealed class LogStreamHeader { + const int MinimumMLPDSupportedVersion = 13; + const int MaximumMLPDSupportedVersion = 14; const int Id = 0x4d505a01; @@ -41,6 +43,10 @@ namespace Mono.Profiler.Log { Version = new Version (reader.ReadByte (), reader.ReadByte ()); FormatVersion = reader.ReadByte (); + + if (FormatVersion < MinimumMLPDSupportedVersion || FormatVersion > MaximumMLPDSupportedVersion) + throw new LogException ($"Unsupported MLPD version {FormatVersion}. Should be >= {MinimumMLPDSupportedVersion} and <= {MaximumMLPDSupportedVersion}"); + PointerSize = reader.ReadByte (); StartupTime = reader.ReadUInt64 (); TimerOverhead = reader.ReadInt32 (); |