[sre] negative FieldBuilder.SetOffset should throw ArgumentException
authorAleksey Kliger <aleksey@xamarin.com>
Fri, 4 Aug 2017 17:52:43 +0000 (13:52 -0400)
committerAleksey Kliger <aleksey@xamarin.com>
Fri, 4 Aug 2017 20:38:24 +0000 (16:38 -0400)
mcs/class/corlib/System.Reflection.Emit/FieldBuilder.cs

index 970e05ca4c5324fe5c3084319ca609f19b53e944..23f27ca17c2747c4306705adaa9fec54406872cd 100644 (file)
@@ -205,6 +205,8 @@ namespace System.Reflection.Emit {
 
                public void SetOffset( int iOffset) {
                        RejectIfCreated ();
+                       if (iOffset < 0)
+                               throw new ArgumentException ("Negative field offset is not allowed");
                        offset = iOffset;
                }