[Mono-bugs] [Bug 54022][Nor] Changed - HashAlgorithm.ComputeHash can allocate huge buffers

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 8 Feb 2004 11:27:35 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by spouliot@videotron.ca.

http://bugzilla.ximian.com/show_bug.cgi?id=54022

--- shadow/54022	2004-02-07 15:28:10.000000000 -0500
+++ shadow/54022.tmp.12075	2004-02-08 11:27:35.000000000 -0500
@@ -1,14 +1,14 @@
 Bug#: 54022
 Product: Mono/Class Libraries
 Version: unspecified
-OS: 
+OS: unknown
 OS Details: 
-Status: NEW   
-Resolution: 
-Severity: 
+Status: RESOLVED   
+Resolution: FIXED
+Severity: Unknown
 Priority: Normal
 Component: CORLIB
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: peter@newton.cx               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
@@ -26,6 +26,21 @@
 don't know if it even gets tested.
 
 ------- Additional Comments From peter@newton.cx  2004-02-07 15:28 -------
 Created an attachment (id=6640)
 Potential memory-saver
 
+
+------- Additional Comments From spouliot@videotron.ca  2004-02-08 11:27 -------
+Thanks a lot for the optimization - the current code has some problems
+(memory sucking being only one). As for the unit tests the patch get
+tested as one of the official NIST SHA-1 tests involves hashing 1 000
+000 bytes 'A'.
+
+However I modified the patch so 
+(a) it always use the second part (4096 bytes buffer). This way it
+doesn't need to use Stream.Length and Stream.Position (which aren't
+available in all streams as I've learned with the CryptoStream class).
+(b) it keeps a copy of the hash result into its HashValue member (like
+the other ComputeHash method epilog). Not doing so will make some
+tests fails in descendant classes (like HMACSHA1 and MACTripleDES).
+