diff options
author | Radek Doulik <rodo@xamarin.com> | 2015-04-07 23:45:38 +0300 |
---|---|---|
committer | Jb Evain <jbevain@gmail.com> | 2015-04-27 17:21:45 +0300 |
commit | 717b17c577a7b2f197f5b2159647e194cede0812 (patch) | |
tree | 279945fb3389b2f4c9fa1f199dc4e4ca5503963d | |
parent | 92e87d149e7d14f17dd439b5dc6eaa8bef8faa90 (diff) |
do not read behind signature boundaries
- when NumNamed count is wrong
- assemblies with such a problem are used in #28198
-rw-r--r-- | Mono.Cecil/AssemblyReader.cs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Mono.Cecil/AssemblyReader.cs b/Mono.Cecil/AssemblyReader.cs index 6ea6a1e..ee440cf 100644 --- a/Mono.Cecil/AssemblyReader.cs +++ b/Mono.Cecil/AssemblyReader.cs @@ -2948,8 +2948,11 @@ namespace Mono.Cecil { public void ReadCustomAttributeNamedArguments (ushort count, ref Collection<CustomAttributeNamedArgument> fields, ref Collection<CustomAttributeNamedArgument> properties) { - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { + if (!CanReadMore ()) + return; ReadCustomAttributeNamedArgument (ref fields, ref properties); + } } void ReadCustomAttributeNamedArgument (ref Collection<CustomAttributeNamedArgument> fields, ref Collection<CustomAttributeNamedArgument> properties) |