[corlib] Add range checks to CharUnicodeInfo. Fixes #25895
authorMarek Safar <marek.safar@gmail.com>
Tue, 13 Jan 2015 10:19:21 +0000 (11:19 +0100)
committerMarek Safar <marek.safar@gmail.com>
Tue, 13 Jan 2015 10:19:21 +0000 (11:19 +0100)
mcs/class/corlib/System.Globalization/CharUnicodeInfo.cs

index 5da049089aa1c11cee177793d31ed7f584d9b92f..fd6820d1d4561e70628cd9eb8e6c70544531dce0 100644 (file)
@@ -290,6 +290,8 @@ namespace System.Globalization
                {
                        if (s == null)
                                throw new ArgumentNullException ("s");
+                       if (((uint)index)>=((uint)s.Length))
+                               throw new ArgumentOutOfRangeException("index");
                        return GetNumericValue (s [index]);
                }
 
@@ -302,6 +304,8 @@ namespace System.Globalization
                {
                        if (s == null)
                                throw new ArgumentNullException ("s");
+                       if (((uint)index)>=((uint)s.Length))
+                               throw new ArgumentOutOfRangeException("index");
                        return Char.GetUnicodeCategory (s, index);
                }
        }