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

Spec bug: What happens with a g,C mapping? #181

Open
nicolo-ribaudo opened this issue Mar 12, 2025 · 3 comments
Open

Spec bug: What happens with a g,C mapping? #181

nicolo-ribaudo opened this issue Mar 12, 2025 · 3 comments

Comments

@nicolo-ribaudo
Copy link
Member

Even including #179, I think our spec is just broken in this case. In https://tc39.es/ecma426/#sec-DecodeBase64VLQ we consume g, then the loop continues and it calls ConsumeBase64ValueAt, which tries to decode , as a base64 value.

#180 fixes it by making it an error explicitly, but I'm opening this issue to make sure it's tested.

What do realm implementations do? Do they error, or do they recover by just assuming that the user meant A instead of g (which is the same bit pattern but without the continuation bit)?

@szuend
Copy link
Collaborator

szuend commented Mar 12, 2025

@jridgewell
Copy link
Member

Nitpicking, but it's impossible to hit , in this case because it's already been split out to create segments.

We can encounter an incomplete segment = "g" (eg, in mappings: "g", mappings: "g;" or mappings: "g,A" after splitting lines and segments). I raised this during the initial review, and it's why we added EOL checking.

@jridgewell
Copy link
Member

What do realm implementations do? Do they error, or do they recover by just assuming that the user meant A instead of g (which is the same bit pattern but without the continuation bit)?

If it's at the end of the mappings, it'll turn into 0 (and further reads will get 0s until we hit 4/5 tuple length). If it's in the middle of a the mappings, it'll turn , or ; into a 0 but then read into the next segment to fill the 4/5 tuple length.

I don't specifically handle it at all 😬. Sourcemaps are machine generated, and I don't wanna slow down everyone for handwritten validation.

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

No branches or pull requests

3 participants