[Mono-bugs] [Bug 350820] New: SecureString.InsertAt does not support appending

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Dec 27 09:39:39 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=350820


           Summary: SecureString.InsertAt does not support appending
           Product: Mono: Class Libraries
           Version: 1.2.6
          Platform: x86
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System.Security
        AssignedTo: spouliot at novell.com
        ReportedBy: dominik.reichl at gmx.de
         QAContact: mono-bugs at ximian.com
          Found By: Development


Created an attachment (id=188809)
 --> (https://bugzilla.novell.com/attachment.cgi?id=188809)
Compilable mini code to reproduce the problem.

Description of problem: The System.Security.SecureString.InsertAt method does
not support appending characters, although it should, according to
documentation.

Code to reproduce the problem:

SecureString s = new SecureString();
s.AppendChar('T');
s.InsertAt(1, 'e');

Actual results: an exception is thrown.
"Unhandled Exception: System.ArgumentException: Offset and length
were out of bounds for the array or count is greater thanthe number
of elements from index to the end of the source collection.
  at System.Buffer.BlockCopy (System.Array src, Int32 srcOffset,
  System.Array dest, Int32 destOffset, Int32 count) [0x000b7] in
  C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\mcs\class\corlib\System\
  Buffer.cs:116 at System.Security.SecureString.InsertAt (Int32 index,
  Char c) [0x000b0] in C:\cygwin\tmp\monobuild\build\BUILD\mono-1.2.6\
  mcs\class\corlib\System.Security\SecureString.cs:168
  at TestSecureString.Program.Main () [0x00000]

Expected Results: No exception should be thrown. The 'e' character should be
appended.

According to Microsoft's documentation of InsertAt, the character is appended
to the string if the position is set to the length of the string.

A similar bug occurs when an empty SecureString is constructed, and InsertAt(0,
c) is used to insert c as first character.

How often does this happen? Always.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list