WebAssembly / WebAssembly/binaryen

Non-UTF string builtins constants?

Open
#7,626 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
WebAssembly
Stars
8.6k
Forks
885
Avg merge
1d 19h
Merged PRs (30d)
69

Description

Discussing with @tlively , we thought it would be good to take the string builtins feature part of #7601 and land that, with the idea that the feature would add validation of string constants: non-utf8 ones would error.

I have code for that in sb.onlyfeat in my fork, however, I see that we can't parse such non-utf8 constants anyhow, e.g.

(module
  (import "\'" "unpaired high surrogate \ED\A0\80 " (global $bad (ref extern)))
)
$bin/wasm-opt test/lit/validation/string-builtins.wast 
Fatal: test/lit/validation/string-builtins.wast:2:52: error: expected import name

So I think that would need to be fixed first? (meanwhile, no one is at risk of trying to use such code, at least...)

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 by reproducing the parser failure with $bin/wasm-opt and the example in test/lit/validation/string-builtins.wast. Read the string builtins work in sb.onlyfeat and determine how non-UTF-8 string constants should be parsed and validated; done means the relevant test input is accepted or rejected with the intended validation behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
wasm
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.