diff options
author | Jb Evain <jb@evain.net> | 2017-08-31 00:14:59 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-08-31 16:25:57 +0300 |
commit | d121ad986546f1a0f4c25cf3c41d2f7b595108fb (patch) | |
tree | bf744ffdb7a27c50c88539eabd45d4c8755a4999 | |
parent | 362e2bb00fa693d04c2d140a4cd313eb82c78d95 (diff) |
Protect against null variable and constant debug informationmono-2017-04
-rw-r--r-- | Mono.Cecil/AssemblyReader.cs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Mono.Cecil/AssemblyReader.cs b/Mono.Cecil/AssemblyReader.cs index 654bf48..7ae6e55 100644 --- a/Mono.Cecil/AssemblyReader.cs +++ b/Mono.Cecil/AssemblyReader.cs @@ -2943,14 +2943,20 @@ namespace Mono.Cecil { if (record.Col2.Length > 0) { scope.variables = new Collection<VariableDebugInformation> ((int) record.Col2.Length); - for (uint i = 0; i < record.Col2.Length; i++) - scope.variables.Add (ReadLocalVariable (record.Col2.Start + i)); + for (uint i = 0; i < record.Col2.Length; i++) { + var variable = ReadLocalVariable (record.Col2.Start + i); + if (variable != null) + scope.variables.Add (variable); + } } if (record.Col3.Length > 0) { scope.constants = new Collection<ConstantDebugInformation> ((int) record.Col3.Length); - for (uint i = 0; i < record.Col3.Length; i++) - scope.constants.Add (ReadLocalConstant (record.Col3.Start + i)); + for (uint i = 0; i < record.Col3.Length; i++) { + var constant = ReadLocalConstant (record.Col3.Start + i); + if (constant != null) + scope.constants.Add (constant); + } } return scope; |