classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bugs in BitSet


From: Carlos Cavanna
Subject: Bugs in BitSet
Date: Wed, 23 Jan 2002 15:02:14 -0500

Hi,

I found a couple of bugs in the BitSet class. Basically some operations do
not test the array bounds correctly. I checked the current CVS version and
I noticed they were not fixed yet.

It is curious that a previous version of classpath (0.02 release) does not
have any of these problems. Since then, some of the loops were rewritten
but the bounds are different. To verify this, I used BitSetTest (that I
think
it comes with Kaffe.)

I attach you my fix.

Regards,
CC

Index: classpath/java/util/BitSet.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/BitSet.java,v
retrieving revision 1.9
diff -r1.9 BitSet.java
114,115c114,115
<     while (++i < bits.length)
<       bits[i] = 0;
---
>     while (i < bits.length)
>       bits[i++] = 0;
131c131
<     while (--i > 0)
---
>     while (--i >= 0)
705c705
<     for (int i = bs.bits.length - 1; i > 0; i--)
---
>     for (int i = bs.bits.length - 1; i >= 0; i--)


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com




reply via email to

[Prev in Thread] Current Thread [Next in Thread]