Skip to content

Allow empty strings as import names for function imports#82

Merged
andreaTP merged 2 commits into
bytecodealliance:mainfrom
andreaTP:fix/allow-empty-import-names
Jul 6, 2026
Merged

Allow empty strings as import names for function imports#82
andreaTP merged 2 commits into
bytecodealliance:mainfrom
andreaTP:fix/allow-empty-import-names

Conversation

@andreaTP

@andreaTP andreaTP commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

The WebAssembly spec permits empty names (zero-length UTF-8 strings) as valid import module and field names. The removed check incorrectly rejected function imports when both names were empty, while other import types (table, memory, global, tag) already accepted them.

Big reported here: roastedroot/endive-cm#15 (comment)

This was a leftover from an earlier iteration of the binary.wast malformed import kind handling, the check got moved into the FUNCTION case but was never removed when the proper byId() catch was added.

andreaTP added 2 commits July 3, 2026 13:56
…d by the import kind byte validation

Also fix import/export kind to be read as a single byte per the spec
binary format, not as LEB128. Overlong LEB128 encodings like 0x80 0x00
were incorrectly accepted as valid kind values.
@andreaTP andreaTP force-pushed the fix/allow-empty-import-names branch from ff30213 to 66804b5 Compare July 3, 2026 13:29
@andreaTP andreaTP merged commit 35dd2a6 into bytecodealliance:main Jul 6, 2026
25 checks passed
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

Successfully merging this pull request may close these issues.

1 participant