microsoft / microsoft/react-native-windows

Hermes crashes on formatting out-of-range date/time inputs

Open
#8,646 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: JavaScript Engine bug Workstream: Developer Experience
Dominant language
C++
Stars
17.3k
Forks
1.2k
Avg merge
1d 13h
Merged PRs (30d)
33

Description

  1. Set useHermes to 'true'
  2. Call toLocaleString() on Date object for times after 03:14:07 UTC on 19 January 2038

Expected Results

Prints the formatted date/time

Actual Result

App crashes

Without an Intl implementation, hermes uses our NLS based implementation of unicode stubs defined in https://github.com/microsoft/hermes-windows/blob/fa9081d1a7f0b8b502c0db6e2a7b429502b33c60/lib/Platform/Unicode/PlatformUnicodeWinGlob.cpp#L324
which is buggy.

The code was originally copied/adapted from ChakraCore codebase here:
https://github.com/chakra-core/ChakraCore/blob/13b5403dcc1270c1d4cdb075d1452ee17202c997/lib/Runtime/Library/DateImplementation.cpp#L419
https://github.com/chakra-core/ChakraCore/blob/13b5403dcc1270c1d4cdb075d1452ee17202c997/lib/Common/Common/DateUtilities.cpp#L234

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/Platform/Unicode/PlatformUnicodeWinGlob.cpp around the NLS-based Unicode stubs referenced in the issue, then reproduce the crash through Hermes with useHermes enabled and a Date after the 2038 timestamp. Compare the relevant behavior with the linked ChakraCore DateImplementation.cpp and DateUtilities.cpp references; done means toLocaleString() formats the out-of-range date/time without crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, react-native
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.