harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shi Jun Zhang (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-6641) [classlib][luni] FloatParser returns wrong value and uses 1GB memory and 100% cpu
Date Fri, 03 Sep 2010 05:44:33 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-6641?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Shi Jun Zhang updated HARMONY-6641:
-----------------------------------

    Attachment: HARMONY-6641.diff

The root cause is that when the exponent is too large or too small, the exponent will overflow
or the FloatPointingParser will parse the very large exponent or very small exponent into
native code, and then causes the 1GB memory usage and 100% cpu usage. Actually when exponent
is larger than 38 for float and larger than 308 for double, the number will be treated as
infinity. The same way to negative exponent.
My patch do 2 things,
1. ensure the exponent will not overflow in the initialParse(String, int) method.
2. if the exponent is too large or too small, just return infinity or 0.0 instead of invoke
the native method.

> [classlib][luni] FloatParser returns wrong value and uses 1GB memory and 100% cpu
> ---------------------------------------------------------------------------------
>
>                 Key: HARMONY-6641
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6641
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M14
>         Environment: all
>            Reporter: Shi Jun Zhang
>         Attachments: HARMONY-6641.diff
>
>
> Float.valueOf("320.0E+2147483647") will return 32.0 and Float.valueOf("-1.4E-2147483314")
will use 1GB memory, 100% cpu and hang. RI will return infinity and -0.0

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message