diff options
Diffstat (limited to 'mcs/class/corlib/Mono.Security.Cryptography/SymmetricTransform.cs')
-rwxr-xr-x | mcs/class/corlib/Mono.Security.Cryptography/SymmetricTransform.cs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/mcs/class/corlib/Mono.Security.Cryptography/SymmetricTransform.cs b/mcs/class/corlib/Mono.Security.Cryptography/SymmetricTransform.cs index b52b05e79ef..036df4108d3 100755 --- a/mcs/class/corlib/Mono.Security.Cryptography/SymmetricTransform.cs +++ b/mcs/class/corlib/Mono.Security.Cryptography/SymmetricTransform.cs @@ -414,7 +414,8 @@ namespace Mono.Security.Cryptography { lastBlock = false; } - byte padding = res [total - 1]; + // total may be 0 (e.g. PaddingMode.None) + byte padding = ((total > 0) ? res [total - 1] : (byte) 0); switch (algo.Padding) { #if NET_2_0 case PaddingMode.ANSIX923: |