Fix for IndexOutOfRangeException in ILReader.ReadOpCode(), part 2 (#84)

* Add failing test

* Fix OperandType.ShortInlineI handling

* Remove invalid comment
This commit is contained in:
Aristarkh Zagorodnikov 2019-02-10 23:48:48 +03:00 committed by Ben Adams
parent adef3aa266
commit 9b85871130
2 changed files with 5 additions and 1 deletions

View File

@ -72,6 +72,7 @@ namespace System.Diagnostics.Internal
case OperandType.ShortInlineBrTarget:
case OperandType.ShortInlineVar:
case OperandType.ShortInlineI:
inlineLength = 1;
break;
@ -97,7 +98,6 @@ namespace System.Diagnostics.Internal
break;
default:
// Can return System.ArgumentException : Unexpected operand type xxx
return null;
}

View File

@ -34,6 +34,10 @@ namespace Ben.Demystifier.Test
40, 160, 4, 0, 6, 114, 253, 15, 0, 112, 115, 90, 0, 0, 10, 122, 254, 6, 32, 5, 0,
6, 115, 137, 2, 0, 10, 115, 61, 2, 0, 6, 42
} },
{ new byte[] {
31, 254, 115, 42, 2, 0, 6, 37, 2, 125, 159, 0, 0, 4, 37, 3, 125, 158, 0, 0, 4, 42
} },
};
// https://github.com/benaadams/Ben.Demystifier/issues/56