Live data from Hacker News

Java Hangs When Converting 2.2250738585072012e-308

exploringbinary.com

51–60 of 70 posts

Re: Java Hangs When Converting 2.2250738585072012e-308

#51
post #50
post #46

Earlier quoted context omitted.

Maybe I'm dense, but why does this affect apps that use JSON?

Because JSON can include floating-point numbers. If you pass { foo: 2.2250738585072012e-308 } to any JSON service, I'd expect it to invoke Double.parseDouble(...) as part of its input processing, and trip over the bug. This would probably occur before any type checking of the input, and thus would probably work even for a service which does not expect floating-point inputs.

So the exact same bug affects Javascript?

Re: Java Hangs When Converting 2.2250738585072012e-308

#52
post #42

Earlier quoted context omitted.

Rasmus just tweeted about it: Java's turn to deal with the x87 register issue. Here's a hint Oracle, "volatile" http://twitter.com/rasmus/status/32365768603602944

Rasmussen's hint would work were the number parsing in Oracle's JDK implemented in in C. Volatile keyword in Java does not guarantee writing to memory and reading it back ( http://java.sun.com/docs/books/jls/third_edition/html/classe... ), but using strictfp as a modifier to the method should cause the usage of strict IEEE 64-bit floating point.

Well, the underlying JVM is written in C (C++ actually) along with a bunch of assembly. I figured this needs to be fixed at the JVM level and as such the fix might very well be a single "volatile" addition like it was for PHP.

Re: Java Hangs When Converting 2.2250738585072012e-308

#53
post #41
post #38

Earlier quoted context omitted.

I tried to dig up a list of websites with a java-backend but my google-fu is not strong enough. I don't think that there are actually many big sites running on java.

There are tons of sites running on java. Possibly more than php.

Most of internet banking systems in my country run on Java. And most of them can be affected if you know where to put this number.

Re: Java Hangs When Converting 2.2250738585072012e-308

#54
post #2

The compiler one is pretty neat. Hung IntelliJ. Didn't hang VS.NET. Had both open, had to try.

This hangs eclipse 3.5.2 when saving the code :)

Ugh, not only that but it hosed my workspace :/

Don't try this in a project you're currently working on. Now I have to spend my morning trying to unfuck my project.

Re: Java Hangs When Converting 2.2250738585072012e-308

#55
post #51
post #50

Earlier quoted context omitted.

Because JSON can include floating-point numbers. If you pass { foo: 2.2250738585072012e-308 } to any JSON service, I'd expect it to invoke Double.parseDouble(...) as part of its input processing, and trip over the bug. This would probably occur before any type checking of the input, and thus would probably work even for a service which does not expect floating-point inputs.

So the exact same bug affects Javascript?

JSON just makes it quite easy to parse in a floating point number. But that doesn't have anything to do with Javascript per-se.

Re: Java Hangs When Converting 2.2250738585072012e-308

#56
post #53
post #41

Earlier quoted context omitted.

There are tons of sites running on java. Possibly more than php.

Most of internet banking systems in my country run on Java. And most of them can be affected if you know where to put this number.

Yes, but fortunately, there is not much reason why anybody would use double when developing a banking system.

Re: Java Hangs When Converting 2.2250738585072012e-308

#57
post #50
post #46

Earlier quoted context omitted.

Maybe I'm dense, but why does this affect apps that use JSON?

Because JSON can include floating-point numbers. If you pass { foo: 2.2250738585072012e-308 } to any JSON service, I'd expect it to invoke Double.parseDouble(...) as part of its input processing, and trip over the bug. This would probably occur before any type checking of the input, and thus would probably work even for a service which does not expect floating-point inputs.

This is not correct. Think about a service which used PHP's json_decode function. PHP has fixed this bug, so there would be no issue.

The problem has nothing to do with JSON. It only affects JSON parsers that run on a JVM.

Re: Java Hangs When Converting 2.2250738585072012e-308

#59
This seems to be a not rare occurrence around the phase boundaries of functions. I had a similar problem with the atan2 function in the PL/I - Fortran library on the CDC 6600. One of my testers was stepping across the boundary between valid and invalid arguments and there was a single binary value that blew up. I was the compiler lead so it got fixed. Any of you remember the 486 floating point problem?

Re: Java Hangs When Converting 2.2250738585072012e-308

#60
post #48
post #35

What about android?

Android is not i386 based and this is x87 FPU and gcc specific bug in commonly used atod() implementation, so I assume that this does not happen on Android.

The bug is in the JDK code running on a JVM (I posted a link to the source). Also runhang.java hangs on my 64bit java vm.
Post reply on HN