Skip to content

Fix readSuspensionHandlers null deref on invalid tag index#575

Merged
titzer merged 3 commits intotitzer:masterfrom
sumleo:fix/wasmparser-tag-null-check
Mar 4, 2026
Merged

Fix readSuspensionHandlers null deref on invalid tag index#575
titzer merged 3 commits intotitzer:masterfrom
sumleo:fix/wasmparser-tag-null-check

Conversation

@sumleo
Copy link
Contributor

@sumleo sumleo commented Feb 25, 2026

Summary

  • readSuspensionHandlers calls readTagRef().tag_index without checking for null. When the tag index is invalid, readTagRef() returns null, causing a null dereference.

Details

WasmParser.v3:384 — store the readTagRef() result in a local, check for null before accessing .tag_index, and return early if null.

readSuspensionHandlers calls readTagRef().tag_index without checking
for null. When the tag index is invalid, readTagRef() returns null,
causing a null dereference.

Store the readTagRef() result and return early if null.
Copy link
Owner

@titzer titzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, can you please add a regression test for this case?

sumleo and others added 2 commits March 4, 2026 22:17
CodeValidator must check err.ok() after readSuspensionHandlers() in
RESUME/RESUME_THROW/RESUME_THROW_REF handlers to avoid processing
partially-filled handler arrays when tag index validation fails.

Add regression test with RESUME instruction referencing invalid tag
index 99 in suspension handler.
Whitespace change to trigger CI
@titzer titzer merged commit acd91c2 into titzer:master Mar 4, 2026
12 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.

2 participants