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

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sat, 7 Feb 2004 15:27:34 -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 peter@newton.cx.

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

--- shadow/54022	2004-02-07 15:27:34.000000000 -0500
+++ shadow/54022.tmp.23518	2004-02-07 15:27:34.000000000 -0500
@@ -0,0 +1,26 @@
+Bug#: 54022
+Product: Mono/Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: CORLIB
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: peter@newton.cx               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: HashAlgorithm.ComputeHash can allocate huge buffers
+
+The function HashAlgorithm.ComputeHash in System.Security.Cryptography, if
+asked to hash a stream, will just allocate a byte array of the size of the
+stream and read it all in one piece. This is going to be slow and wasteful
+for a large stream.
+
+The soon-to-be-attached patch reads the stream in chunks of 4096 if the
+length is any longer. The code seems to pass the corlib unit tests but I
+don't know if it even gets tested.