[mono/mono] [2 commits] bb3d1b7c: Minor fix to avoid ArgumentOutOfRangeException

"Jeffrey Stedfast ([email protected])" <[email protected]>
Newsgroups gmane.comp.gnome.mono.patches
Message-ID <00000141aeb7a067-ea59f5b4-3001-4d20-a641-c456d46b98aa-000000@email.amazonses.com>
   Branch: refs/heads/master
     Home: https://github.com/mono/mono
  Compare: https://github.com/mono/mono/compare/0cbc4ad6c0eb...779127e0a5ca

   Commit: bb3d1b7ca3966d2e264bf5a0fb0a376726c385d4
   Author: David Schmitt <[email protected]> (DavidS)
     Date: 2013-10-09 08:36:37 GMT
      URL: https://github.com/mono/mono/commit/bb3d1b7ca3966d2e264bf5a0fb0a376726c385d4

Minor fix to avoid ArgumentOutOfRangeException

When the file is empty, data[0] would throw and swallow the original exception.

Changed paths:
  M mcs/tools/security/sn.cs

Modified: mcs/tools/security/sn.cs
===================================================================
@@ -126,7 +126,7 @@ static RSA GetKeyFromFile (string filename)
 				return new StrongName (data).RSA;
 			}
 			catch {
-				if (data [0] != 0x30)
+				if (data.Length == 0 || data [0] != 0x30)
 					throw;
 				// this could be a PFX file
 				Console.Write ("Enter password for private key (will be visible when typed): ");

   Commit: 779127e0a5cac26926da5abfc60d7eae48625fc8
   Author: Jeffrey Stedfast <[email protected]> (jstedfast)
     Date: 2013-10-12 22:07:27 GMT
      URL: https://github.com/mono/mono/commit/779127e0a5cac26926da5abfc60d7eae48625fc8

Merge pull request #774 from DavidS/patch-1

Minor fix to avoid ArgumentOutOfRangeException

Changed paths:
  M mcs/tools/security/sn.cs

Modified: mcs/tools/security/sn.cs
===================================================================
@@ -126,7 +126,7 @@ static RSA GetKeyFromFile (string filename)
 				return new StrongName (data).RSA;
 			}
 			catch {
-				if (data [0] != 0x30)
+				if (data.Length == 0 || data [0] != 0x30)
 					throw;
 				// this could be a PFX file
 				Console.Write ("Enter password for private key (will be visible when typed): ");


_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.