Repository navigation
fix(api): avoid encoder panic on normalized numeric literals - #65482
Draft
Jemmy (JemmyIndex) wants to merge 1 commit into
Draft
Jemmy (JemmyIndex) wants to merge 1 commit into
Jemmy (JemmyIndex) wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #65451
stringTable.addtries to reuse source text by deriving a start offset from the length of a literal's normalized text. For inputs such as.1,1e3, and1e9, the normalized text is longer than the source and the derived start is negative. Slicing the source at that offset panics before the existing string-table fallback can run.Check that the start is nonnegative before comparing the source slice. Text that cannot be reused then follows the existing fallback without changing numeric normalization or the wire format.
The regression test parses, encodes, and decodes ten inputs, checking both the original source text and the normalized numeric literal text. It covers the three reported crashes, ordinary integers, equal-length normalization, leading trivia, numeric separators, and hexadecimal notation.
Validation:
.1regression panics withslice bounds out of range [-1:].node node_modules/hereby/bin/hereby.js validate --all(equivalent tonpx hereby validate --all): native and WASM builds, extension tests (57), native API tests (1,077), WASM async API tests (405 passed, 1 skipped), WASM sync API tests (564 passed, 1 skipped), API declarations, Herebyfile, tools tests, options tests, CLI smoke tests, lint, and formatting all pass.TestSubscribeSymlinkCreate/windows,TestSubscribeSymlinkDelete/windows, and their parent tests. Both underlying failures are this Windows host's inability to create symlinks (A required privilege is not held by the client.); no tests were changed or skipped to suppress them. Consequently, the full validation command exits 1.check:formatandtidytasks with the same Hereby entry point; both pass. Dependency files remain unchanged;git diff --checkpasses.Checklist:
056d69edb807d4cd4351059f084a7f191c6aea0f..1case panics before the fix and the encoder package passes after it.AI assistance: Codex authored the patch and regression test after I selected this specific issue. I will review the changes and personally follow up on review feedback.