diff options
author | Rodrigo Kumpera <kumpera@gmail.com> | 2015-11-26 05:45:29 +0300 |
---|---|---|
committer | Rodrigo Kumpera <kumpera@gmail.com> | 2016-03-02 18:19:31 +0300 |
commit | 6a122b823c4105f962fc2b43df0d864a72ecf98a (patch) | |
tree | f4a3026f97fe80478b05ad25dbe9956bbcbd0310 /mcs/class/PEAPI | |
parent | 2bd29b6ea29ce61db94b98e25b35d692e6592fd0 (diff) |
[PEAPI] Fixed encoded token sizes for HasCustomAttribute, CustomAttributeType and MemberRefParent.
This would cause some large il files to be miscompiled as the token size would not be the expected one.
This was found in b28158/test.il.
Diffstat (limited to 'mcs/class/PEAPI')
-rw-r--r-- | mcs/class/PEAPI/Metadata.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/mcs/class/PEAPI/Metadata.cs b/mcs/class/PEAPI/Metadata.cs index d983c8a2a2c..f0dd7de3176 100644 --- a/mcs/class/PEAPI/Metadata.cs +++ b/mcs/class/PEAPI/Metadata.cs @@ -5346,12 +5346,20 @@ namespace PEAPI { MDTable tabIx = (MDTable)i; if (count > max5BitSmlIx) { + if (tabIx == MDTable.Method || tabIx == MDTable.Field || tabIx == MDTable.TypeRef || + tabIx == MDTable.TypeDef || tabIx == MDTable.Param || tabIx == MDTable.InterfaceImpl || + tabIx == MDTable.MemberRef || tabIx == MDTable.Module || tabIx == MDTable.DeclSecurity || + tabIx == MDTable.Property || tabIx == MDTable.Event || tabIx == MDTable.StandAloneSig || + tabIx == MDTable.ModuleRef || tabIx == MDTable.TypeSpec || tabIx == MDTable.Assembly || + tabIx == MDTable.AssemblyRef || tabIx == MDTable.File || tabIx == MDTable.ExportedType || + tabIx == MDTable.ManifestResource || tabIx == MDTable.GenericParam) lgeCIx[(int)CIx.HasCustomAttr] = true; } if (count > max3BitSmlIx) { - if ((tabIx == MDTable.TypeRef) || (tabIx == MDTable.ModuleRef) || (tabIx == MDTable.Method) || (tabIx == MDTable.TypeSpec) || (tabIx == MDTable.Field)) + if (tabIx == MDTable.Method || tabIx == MDTable.MemberRef) lgeCIx[(int)CIx.CustomAttributeType] = true; - if ((tabIx == MDTable.Method) || (tabIx == MDTable.MemberRef)) + if (tabIx == MDTable.TypeDef || tabIx == MDTable.TypeRef || tabIx == MDTable.ModuleRef || + tabIx == MDTable.Method || tabIx == MDTable.TypeSpec) lgeCIx[(int)CIx.MemberRefParent] = true; } if (count > max2BitSmlIx) { |