Bug 13435 - SIGSEGV instead of CustomAttributeFormatException
Summary: SIGSEGV instead of CustomAttributeFormatException
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Reflection (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
URL:
: 13434 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-07-24 07:53 UTC by Marek Safar
Modified: 2013-08-20 19:11 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
test file (6.00 KB, application/x-msdownload)
2013-07-24 07:53 UTC, Marek Safar
Details
dependency (45.00 KB, application/x-msdownload)
2013-07-24 07:54 UTC, Marek Safar
Details

Description Marek Safar 2013-07-24 07:53:06 UTC
Compile & run

using System;
using System.Reflection;
using System.Collections.Generic;

namespace test5
{
	public class MainClass
	{
		static CustomAttributeData FindAttribute (IList<CustomAttributeData> attributesData, string attrName, string attrNamespace)
		{
			if (attributesData.Count == 0)
				return null;

			foreach (var attr in attributesData) {
				var dt = attr.Constructor.DeclaringType;
				if (dt.Name == attrName && dt.Namespace == attrNamespace)
					return attr;
			}

			return null;
		}

		public static void Main (string[] args)
		{
			var a = Assembly.LoadFile ("test-ps-018.exe");
			var t = a.GetType ("_root.ConstantFields");
			var p = t.GetProperty ("cs9");

			var attributes = CustomAttributeData.GetCustomAttributes (p);

			var data = FindAttribute (attributes, "ConstantFieldAttribute", "PlayScript.Runtime.CompilerServices");
			if (data != null) {
				if (data.ConstructorArguments.Count == 1) {
					return;
				}
			}

			return;

		}
	}
}
Comment 1 Marek Safar 2013-07-24 07:53:54 UTC
Created attachment 4414 [details]
test file
Comment 2 Marek Safar 2013-07-24 07:54:17 UTC
Created attachment 4415 [details]
dependency
Comment 3 Marek Safar 2013-07-24 07:54:41 UTC
Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Reflection.CustomAttributeData.ResolveArgumentsInternal (System.Reflection.ConstructorInfo,System.Reflection.Assembly,intptr,uint,object[]&,object[]&) <0xffffffff>
  at System.Reflection.CustomAttributeData.ResolveArguments () <0x0005f>
  at System.Reflection.CustomAttributeData.get_ConstructorArguments () <0x00013>
  at test5.MainClass.Main (string[]) <0x00071>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <0xffffffff>
Comment 4 Zoltan Varga 2013-07-27 20:53:39 UTC
We now throw a proper exception when running with --security=validil.
Comment 5 Zoltan Varga 2013-07-27 20:56:17 UTC
*** Bug 13434 has been marked as a duplicate of this bug. ***
Comment 6 Rodrigo Kumpera 2013-08-20 19:11:23 UTC
Fixed in master.

Note You need to log in before you can comment on or make changes to this bug.