Skip to content
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

Ion binary crashes with floating point exception #221

Closed
docfate111 opened this issue Dec 8, 2020 · 4 comments
Closed

Ion binary crashes with floating point exception #221

docfate111 opened this issue Dec 8, 2020 · 4 comments

Comments

@docfate111
Copy link

Running build-release.sh to install creates ion and ionizer.
Going into ion-c/build/release/tools/cli

Running

ion process [filename]

cause floating point exception for some inputs such as

[[1, -12D516753754312305], [-629107941, 255.0], []]

or

[[1, -12.516753754312305], [-6D9107941, 255.0], []]
@docfate111 docfate111 changed the title Ion binary crashes with illegal Ion binary crashes with floating point exception Dec 8, 2020
@tgregg
Copy link
Contributor

tgregg commented Feb 9, 2021

This error is triggered by the following numbers.

-12D516753754312305
-6D9107941

This seems to be because the decNumber library does not support exponents this large. It should fail more gracefully than with SIGFPE, though.

Do you have a use case for decimals with exponents this large?

@docfate111
Copy link
Author

No I am just practicing fuzzing stuff/looking for security issues.

@tgregg
Copy link
Contributor

tgregg commented Feb 10, 2021

Thanks for the report, @docfate111 . I'm going to reopen this so we can raise a more graceful error.

@tgregg tgregg reopened this Feb 10, 2021
m6w6 added a commit to m6w6/ion-c that referenced this issue Nov 23, 2021
The global decContext `g_IonEventDecimalContext` has traps set to
DEC_Errors, which wouldn't be set if `decContextDefault()` would be
used with any `kind` but DEC_INIT_BASE.
@m6w6
Copy link
Contributor

m6w6 commented Nov 23, 2021

Is there any reason decContext.traps is actually set?

diff --git a/tools/events/ion_event_util.cpp b/tools/events/ion_event_util.cpp
index 5a26a5d..5f61843 100644
--- a/tools/events/ion_event_util.cpp
+++ b/tools/events/ion_event_util.cpp
@@ -22,7 +22,7 @@ decContext g_IonEventDecimalContext = {
         DEC_MAX_MATH,                   // max exponent
         -DEC_MAX_MATH,                  // min exponent
         DEC_ROUND_HALF_EVEN,            // rounding mode
-        DEC_Errors,                     // trap conditions
+        0,                              // trap conditions
         0,                              // status flags
         0                               // apply exponent clamp?
 };
{
  error_type: READ,
  message: "/home/mike/src/ion-c/tools/events/ion_event_stream.cpp:364 : IERR_NUMERIC_OVERFLOW",
  location: "sigfpe.ion"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants