-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash in Java powInt function #261
Comments
Thanks. I will handle this. |
Can you share your code? In my case I do to see an exception, just NaN
|
"^^" this a tetration operator - so syntax is fully ok |
Also tokenizer did the job as expected, please note that "B32." prefix notifies parser that it is a base 32 number literal.
|
Sorry I forgot that I used the first bits of the input as Booleans for some of the libs options.
crashes with: Exception in thread "main" java.lang.NumberFormatException: Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark. Another Input: -3!<=3^2^9^92^9~&2 Exception in thread "main" java.lang.ArithmeticException: Invalid operation |
Ok!! Now I have the exception :-) Thanks! This is the first bug since many months :-) Great occasion to make the library better. I will solve this very fast + I will make a release. |
No problem. Part of a lab course at my University. I used Jazzer (https://github.com/CodeIntelligenceTesting/jazzer) for the fuzzing. |
So, clear. BigDecimal.valueOf(double val) throws exception when double is NaN or Infinite (from doc "NumberFormatException – if val is infinite or NaN."). I do not like to solve problems by catching the exceptions, I will solve this differently. |
Should have seen that myself ^^ |
The bug was only present in java code, C# code worked well :-) |
Let me know when tested and confirmed - based on your confirmation I will make a release. |
Ok so this exception seems fixed: Exception in thread "main" java.lang.NumberFormatException: Character I is neither a decimal digit number, decimal point, nor "e" notation exponential mark. There are still two more: Input: callApi("-3!<=3^2^9^92^9~&2"); Crash: Input: callApi("2^2^^2^2^^2^2^^2222∛2^9^92^92^^0=2^9^92^9^2^2^9^92^92^^0=222^22^^2^9^9<--2^92^^0<2^9^92^9^2^2^9^92^92^^0=2^9^92^92"); Crash: |
Thanks. It seems this this time I have to catch the exceptions as the number for BigDecimal pow is to big. |
Can you test it now? Thanks :-) |
Looks fine. No crashes after a 10min fuz run. Before there were some after like 10sek. I will let it run for some more hours but I think it is fixed. |
Thanks, I did additional verification against all BiigDecimal in the code. |
MathParser.org-mXparser version: v.5.0.4
Framework: Java
Bug:
While fuzzing the library I found multiple inputs crashing it.
All of them have a syntax which passes checkSyntax().
The problem looks to be at org.mariuszgromada.math.mxparser.mathcollection.MathFunctions.powInt(MathFunctions.java:1050).
Take a look at the attached file.
A quick fix would be just catching the exception:
Exceptions:
Crashes.txt
Just two random inputs which crash:
crash-1a92d270625b937901abb263be8bbd031cab9106.txt
crash-7ecf46c837d7aa976de9844ad1ce9e485b6d2248.txt
The text was updated successfully, but these errors were encountered: