This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch: FYI: important memory-trashing fix

>>>>> "Scott" == Scott Gilbertson <> writes:

Scott> Double.parseDouble no longer parses strings with leading
Scott> spaces.  My app previously worked but now gets a
Scott> NumberFormatException.  A small test case (attached) sees the
Scott> same thing.

Scott> It seems to me that "length + start" is guaranteed to be no greater than
Scott> "str->length()", so the old version was correct.

You are right.  Sorry about that, and thanks for catching this.

Fixed as appended.

There's already a Mauve test for this.  I'm not sure why my nightly
testing didn't pick up this failure, since running Mauve by hand
showed it :-(


Index: ChangeLog
from  Tom Tromey  <>

	* java/lang/ (parseDouble): Reverted patch of

Index: java/lang/
RCS file: /cvs/gcc/gcc/libjava/java/lang/,v
retrieving revision 1.17
diff -u -r1.17
--- java/lang/ 14 Nov 2003 01:48:30 -0000 1.17
+++ java/lang/ 26 Nov 2003 17:29:48 -0000
@@ -183,7 +183,7 @@
       // Note that UTF can expand 3x.
       char *data = (char *) __builtin_alloca (3 * length + 1);
-      jsize blength = _Jv_GetStringUTFRegion (str, start, str->length(), data);
+      jsize blength = _Jv_GetStringUTFRegion (str, start, length, data);
       data[blength] = 0; 
       struct _Jv_reent reent;  

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]