[Mono-bugs] [Bug 78941][Min] Changed - System.Collections.Queue can be made to throw IndexOutOfRangeException

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Wed Aug 2 15:13:49 EDT 2006

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 benlutz at datacomm.ch.


--- shadow/78941	2006-08-02 15:11:04.000000000 -0400
+++ shadow/78941.tmp.31825	2006-08-02 15:13:49.000000000 -0400
@@ -89,6 +89,15 @@
 breaking other things. Please ignore the first inline patch above.
 ------- Additional Comments From benlutz at datacomm.ch  2006-08-02 15:11 -------
 Created an attachment (id=17393)
 Queue patch, 3rd attempt
+------- Additional Comments From benlutz at datacomm.ch  2006-08-02 15:13 -------
+My second patch was unfortunately flawed too, calling TrimToSize() on 
+an empty Queue would lead to a division by 0.
+I'm confident that this third attempt is now correct. Simply setting 
+_tail to 0 in TrimToSize() is valid because _tail should be set to 
+(_head + _size) % _array.Length, which is 0 because _array.Length == 
+_size and _head == 0 at this point.

More information about the mono-bugs mailing list