Skip to content

Conversation

@nickva
Copy link
Contributor

@nickva nickva commented Mar 11, 2025

Most engines like v8, and current versions of spidermonkey versions (128 at least) return NaN while QuickJS parses up to 9 digits at a time, then tries to parse the rest. Trying to parse extra digits can sometimes produce random garbage. To fix it, when parsing the initial integer parse as many digits as we can (max = 0) instead of just 9.

Add a few tests, including uncommenting some previous ones, and ensure they pass on v8 version 11.

Fixes: #384

@nickva nickva force-pushed the fix-parsing-more-than-9-digits branch 2 times, most recently from 2ae0560 to 960020a Compare March 11, 2025 02:21
Most engines like v8, and current versions of spidermonkey versions (128 at
least) return NaN while QuickJS parses up to 9 digits at a time, then tries to
parse the rest. Trying to parse extra digits can sometimes produce random
garbage. To fix it, when parsing the initial integer parse as many digits as we
can (max = 0) instead of just 9.

Add a few tests, including uncommenting some previous ones, and ensure they
pass on v8 version 11.

Fixes: bellard#384
@nickva nickva force-pushed the fix-parsing-more-than-9-digits branch from 960020a to abb4315 Compare March 13, 2025 01:24
@bellard
Copy link
Owner

bellard commented Mar 13, 2025

included.

@bellard bellard closed this Mar 13, 2025
@nickva nickva deleted the fix-parsing-more-than-9-digits branch April 7, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants