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

Fixes nasa/fprime#3174 by fixing interanl and JSON large number handling #190

Open
wants to merge 3 commits into
base: devel
Choose a base branch
from

Conversation

LeStarch
Copy link
Collaborator

@LeStarch LeStarch commented Feb 6, 2025

Related Issue(s)
Has Unit Tests (y/n)
Documentation Included (y/n)

Change Description

This fixes the big number (and other so called invalid) JSON object handling by pulling the JSON.parse and JSON.stringify implementations into a custom parser that intercepts the calls.

This parser replaces bad tokens with a custom object representation of the item, and then uses the replacer and reviver functions to restore the correct value.

Rationale

JSON.parse cannot handle BigInt, NaN, Infinite, and null. This side steps the issue by performing string manipulation to and from a looser specification, then using JSON, and then restoring the values from.

Testing/Review Recommendations

Try to break it with input from the box.

Future Work

Note any additional work that will be done relating to this issue.

@LeStarch LeStarch requested a review from thomas-bc February 6, 2025 02:48
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.

1 participant