From 0169babb4911f09c267d67801cc17f2c5b356022 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Mon, 24 Jan 2011 13:47:28 +0000 Subject: [PATCH] Guard against invalid predefined assembly attributes --- mcs/mcs/import.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/mcs/mcs/import.cs b/mcs/mcs/import.cs index 2be579ccdec..e3ada6de4f2 100644 --- a/mcs/mcs/import.cs +++ b/mcs/mcs/import.cs @@ -1563,8 +1563,12 @@ namespace Mono.CSharp importer.GetCustomAttributeTypeName (a, out ns, out name); if (name == "CLSCompliantAttribute") { - if (ns == "System") - cls_compliant = (bool) a.ConstructorArguments[0].Value; + if (ns == "System") { + try { + cls_compliant = (bool) a.ConstructorArguments[0].Value; + } catch { + } + } continue; } @@ -1572,7 +1576,13 @@ namespace Mono.CSharp if (ns != MetadataImporter.CompilerServicesNamespace) continue; - string s = a.ConstructorArguments[0].Value as string; + string s; + try { + s = a.ConstructorArguments[0].Value as string; + } catch { + s = null; + } + if (s == null) continue; -- 2.25.1