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

Uint8Array-only methods #429

Open
phoddie opened this issue Apr 1, 2024 · 0 comments
Open

Uint8Array-only methods #429

phoddie opened this issue Apr 1, 2024 · 0 comments

Comments

@phoddie
Copy link
Contributor

phoddie commented Apr 1, 2024

This is more a question than an issue.

The "Base64" proposal in TC39 is now at Stage 3. We have an implementation for XS and want to run Fuzzilli against that. The Base64 proposal does something unusual for JavaScript: it defines new methods on Uint8Array but not any other TypedArrays.

  • Uint8Array.fromBase64("....")
  • Uint8Array.of(1,2,3).toBase64()
  • (new Uint8Array(100)).setFromBase64("...")

Up to this point, all TypedArrays have had the same methods. Fuzzilli takes advantage of this in JavaScriptEnvironment.swift to avoid having to define ObjectGroups, etc for each individual TypedArray.

The question is how best to integrate the Base64 features of Uint8Array into JavaScriptEnvironment.swift?

The fromBase64 and setFromBase64 methods both accept an optional options object to configure the decoding. These have special values ("loose", "strict", "stop-before-partial", "base64", "base64url" which the Explorer can't discover. To make sure they get covered, I've implemented a base64 code generator. Maybe this approach combined with the various mutators is adequate and there's no need to worry about modifying JavaScriptEnvironment.swift.

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

1 participant