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:27:04 +0300 |
commit | c0eb983dac62519d3ae93a689312076aacecb723 (patch) | |
tree | 562d94e2ccfadd4d55475420829fa5d61f00b6cb | |
parent | dc351106afabb3304dc2fcd3e6a25749c5ea8cb1 (diff) |
Protect against null variable and constant debug informationmono-2017-06
-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 8217bc0..02d7787 100644 --- a/Mono.Cecil/AssemblyReader.cs +++ b/Mono.Cecil/AssemblyReader.cs @@ -2954,14 +2954,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; |