diff options
author | Samuel Arzt <arzt.samuel@live.de> | 2017-09-22 18:48:25 +0300 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2017-09-22 18:48:25 +0300 |
commit | 5705c262df6b6da588e65eb4d7224700e10d9c87 (patch) | |
tree | ebbfba2eee46d006cb3998ba2ee065af068472ce /src/ILVerify | |
parent | 6e9831a42ded8fd660f0298a663f69cc9389afc5 (diff) |
[ILVerify] Fix block re-verification possibly causing endless loop (#4575)
* Fixed block re-verification after stack merge possibly causing endless loop.
* Refactored BasicBlock.EndOffset to BasicBlock.ImportState.
Diffstat (limited to 'src/ILVerify')
-rw-r--r-- | src/ILVerify/src/ILImporter.Verify.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ILVerify/src/ILImporter.Verify.cs b/src/ILVerify/src/ILImporter.Verify.cs index 7b85ee628..3b94fd25c 100644 --- a/src/ILVerify/src/ILImporter.Verify.cs +++ b/src/ILVerify/src/ILImporter.Verify.cs @@ -81,10 +81,17 @@ namespace Internal.IL class BasicBlock { // Common fields + public enum ImportState : byte + { + Unmarked, + IsPending, + WasVerified + } + public BasicBlock Next; public int StartOffset; - public int EndOffset; + public ImportState State = ImportState.Unmarked; public StackValue[] EntryStack; @@ -698,6 +705,7 @@ namespace Internal.IL void EndImportingBasicBlock(BasicBlock basicBlock) { + basicBlock.State = BasicBlock.ImportState.WasVerified; } void ImportNop() @@ -1226,8 +1234,8 @@ namespace Internal.IL { entryStack[i] = mergedValue; - if (next.ErrorCount == 0) - next.EndOffset = 0; // Make sure block is reverified + if (next.ErrorCount == 0 && next.State != BasicBlock.ImportState.IsPending) + next.State = BasicBlock.ImportState.Unmarked; // Make sure block is reverified } } } |