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

Fix parsing dates with more than 9 contiguous digits #385

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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

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 2ae0560 to 960020a Compare March 11, 2025 02:21
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.

Date parsing is broken when there are more than 9 contiguous date digits
1 participant