serious bug hits jvm as well: Double.parseDouble("2.2250738585072012e-308")

275 views
Skip to first unread message

Andreas Petersson

unread,
Feb 1, 2011, 5:55:17 AM2/1/11
to The Java Posse
even worse, you can use that bug to crash the compiler, too.

I bet one can use that to kill a on of java-running websites.

i read that article on http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/
which explains the matter.

Andreas Petersson

unread,
Feb 1, 2011, 7:48:15 AM2/1/11
to The Java Posse
a number of places where i found this to be a cereal problem where you
won't suspect them:

Credit Card Validators (checks first if given string is a number)
(Pentaho Data Integration)
Version Numbers (in xml headers) (Xstream)
and to my surprise
HTTP headers (http://www.w3.org/Protocols/rfc2616/rfc2616-
sec3.html#sec3.9) (Spring Framework et al)

Ricky Clarkson

unread,
Feb 1, 2011, 7:54:11 AM2/1/11
to java...@googlegroups.com
I never thought I'd see that in my cornflakes.

> --
> You received this message because you are subscribed to the Google Groups "The Java Posse" group.
> To post to this group, send email to java...@googlegroups.com.
> To unsubscribe from this group, send email to javaposse+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
>
>

Andrew

unread,
Feb 1, 2011, 5:28:19 PM2/1/11
to The Java Posse
Works fine in Apache Harmony 6.0M3. Now I understand why they
couldn't give it a TCK - it might pass some tests that the Snoracle
version won't! :-)

On Feb 1, 9:55 pm, Andreas Petersson <andr...@petersson.at> wrote:
> even worse, you can use that bug to crash the compiler, too.
>
> I bet one can use that to kill a on of java-running websites.
>
> i read that article onhttp://www.exploringbinary.com/java-hangs-when-converting-2-225073858...
> which explains the matter.

Christian Catchpole

unread,
Feb 1, 2011, 6:37:55 PM2/1/11
to The Java Posse
I knew my girlfriend was a robot when I mentioned the
2.2250738585072012e-308 thing and her head exploded. I'm glad she was
Java though.

mbien

unread,
Feb 1, 2011, 7:09:20 PM2/1/11
to The Java Posse
maybe she was.... PHP?!

Christian Catchpole

unread,
Feb 1, 2011, 7:19:45 PM2/1/11
to The Java Posse
i know you're probably angry right now so i'll pretend you didn't say
that

Josh McDonald

unread,
Feb 1, 2011, 7:47:42 PM2/1/11
to java...@googlegroups.com
Free tip to everybody planning to try this out: don't do it in an IDE project with build-on-save... Kaboom!

Steven Herod

unread,
Feb 1, 2011, 11:56:00 PM2/1/11
to The Java Posse
I'm doing more extensive testing and getting my partner to count to it
from 0.

Carl Jokl

unread,
Feb 2, 2011, 4:21:02 AM2/2/11
to The Java Posse
This bug works on the Mac to...its like write once....crash
everywhere! It did at least compile but seemed to take a very long
time about it.

Casper Bang

unread,
Feb 2, 2011, 4:47:01 AM2/2/11
to The Java Posse
Doesn't manifest itself on Android. Perhaps Google could use that as
evidence that Android is not Java nor did Apache copy Harmony. :)

On Feb 1, 11:55 am, Andreas Petersson <andr...@petersson.at> wrote:
> even worse, you can use that bug to crash the compiler, too.
>
> I bet one can use that to kill a on of java-running websites.
>

Rob Ross

unread,
Feb 2, 2011, 5:24:01 AM2/2/11
to java...@googlegroups.com


When you say "on the Mac", do you mean on the Apple JVM?

I tried replicating this in a native Objective-C app but was not able to make it crash. So either I'm exercising the wrong code, or it's a software-only bug in the JDK libraries.


Rob

Nick Brown

unread,
Feb 2, 2011, 8:43:45 AM2/2/11
to The Java Posse
Well it would have to be using Double.parseDouble. I would imagine
most of those would be using parseInteger or parseLong (at least as
far as I know, floating point values are not valid credit card
numbers).

Augusto Sellhorn

unread,
Feb 2, 2011, 4:27:06 PM2/2/11
to The Java Posse
Don't see a problem in Netbeans so far ... not sure if I have that
turned out. Either way at worst it's going to hang a thread, not sure
if that will stop all builds ...

On Feb 1, 7:47 pm, Josh McDonald <josh.g.mcdon...@hotmail.com> wrote:
> Free tip to everybody planning to try this out: don't do it in an IDE
> project with build-on-save... Kaboom!
>
> On 2 February 2011 10:19, Christian Catchpole <ato...@catchpole.net> wrote:
>
>
>
>
>
>
>
> > i know you're probably angry right now so i'll pretend you didn't say
> > that
>
> > On Feb 2, 10:09 am, mbien <mb...@fh-landshut.de> wrote:
> > > maybe she was.... PHP?!
>
> > > On Feb 2, 12:37 am, Christian Catchpole <ato...@catchpole.net> wrote:
>
> > > > I knew my girlfriend was a robot when I mentioned the
> > > > 2.2250738585072012e-308 thing and her head exploded. I'm glad she was
> > > > Java though.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "The Java Posse" group.
> > To post to this group, send email to java...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > javaposse+...@googlegroups.com<javaposse%2Bunsubscribe@googlegroups .com>
> > .

Christian Catchpole

unread,
Feb 2, 2011, 6:51:06 PM2/2/11
to The Java Posse
I did this on OS X and it looks like the 2.2250738585072012e-308 thing
causes spinning. Dodgy parser? http://twitpic.com/3vwtcq

Rob: It shouldn't show up in Objective-C. Its code in the core of the
JDK. Either in the Java libraries, native code, JIT code.. somewhere..
But it's probably common code for a lot of JDKs.

Christian Catchpole

unread,
Feb 2, 2011, 7:08:29 PM2/2/11
to The Java Posse
I'm so glad I read the original article. Sorry for repeating the
obvious :)

On Feb 3, 9:51 am, Christian Catchpole <ato...@catchpole.net> wrote:
> I did this on OS X and it looks like the 2.2250738585072012e-308 thing
> causes spinning. Dodgy parser?http://twitpic.com/3vwtcq

Josh McDonald

unread,
Feb 2, 2011, 7:19:00 PM2/2/11
to java...@googlegroups.com
It also will blow up other languages for which the compiler is written in Java. I tested it as a constant in Flex and it sent Eclipse to its grave, because you can't cancel the compile, and can't save or quit while it's waiting for the compile to finish.

-Josh

--
You received this message because you are subscribed to the Google Groups "The Java Posse" group.
To post to this group, send email to java...@googlegroups.com.
To unsubscribe from this group, send email to javaposse+...@googlegroups.com.

Miroslav Pokorny

unread,
Feb 2, 2011, 10:15:28 PM2/2/11
to java...@googlegroups.com
Does the problem also exist for Float.parseFloat for the same reasons ?
Reply all
Reply to author
Forward
0 new messages