Skip to content

Fixing out of range crash#109

Merged
roshkhatri merged 2 commits into
valkey-io:unstablefrom
zackcam:Out-of-range
Jun 10, 2026
Merged

Fixing out of range crash#109
roshkhatri merged 2 commits into
valkey-io:unstablefrom
zackcam:Out-of-range

Conversation

@zackcam

@zackcam zackcam commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Fix for: #105

This fix uses the suggested change of switching to strtod. As this will convert overflows to inf, and not just throw an error. This library still works on subnormal values as well. We do not need an extra check for ERANGE from what I could tell as we are covered by the inf check in JSONUTIL_ADDITION_OVERFLOW

Two new tests are created the one in dom checks for three different cases, normal + subnormal, subnormal + normal then an overflow check.

Signed-off-by: zackcam <zackcam@amazon.com>
@roshkhatri roshkhatri self-requested a review June 9, 2026 03:43

@roshkhatri roshkhatri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks great, just a comment about the test case

also can we add a test for a huge negative number, which would produce negative infinity.

Comment thread tst/unit/dom_test.cc
Comment thread tst/unit/selector_test.cc Outdated
Signed-off-by: Roshan Khatri <117414976+roshkhatri@users.noreply.github.com>

@roshkhatri roshkhatri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this looks good, the tests we have are the failure cases in the issue so that okay

@roshkhatri roshkhatri merged commit faf58c3 into valkey-io:unstable Jun 10, 2026
19 checks passed
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

Successfully merging this pull request may close these issues.

2 participants