Skip to content

[wasm_split] Fix crash when manifest starts with a blank line - #9264

Open
sorensp-goog wants to merge 1 commit into
WebAssembly:mainfrom
sorensp-goog:crash
Open

sorensp-goog wants to merge 1 commit into
WebAssembly:mainfrom
sorensp-goog:crash

Conversation

@sorensp-goog

Copy link
Copy Markdown

When the first line of the manifest file is blank, currFuncs is null, but will be dereferenced to check if the current module will be empty.

This CL fixes that and also cleans up the logic to clarify how the state machine works.

@sorensp-goog
sorensp-goog requested a review from a team as a code owner October 15, 2026 14:37
@sorensp-goog
sorensp-goog requested review from stevenfontanella and removed request for a team October 15, 2026 14:37
@stevenfontanella

Copy link
Copy Markdown
Member

Can you give an example repro program + wasm-split invocation that demonstrates the crash, and ideally add a lit test as well? I see some wasm-split lit tests in test/lit/wasm-split. You can add a lit test by adding a RUN: line and then running

python3 scripts/update_lit_checks.py -f <test path>`

@sorensp-goog

Copy link
Copy Markdown
Author

Can you give an example repro program + wasm-split invocation that demonstrates the crash, and ideally add a lit test as well?

There is no repro program as such, but any manifest that starts with a blank line will provoke a crash. I added a lit test that covers various aspect of this state machine, including this one.

Comment thread src/tools/wasm-split/wasm-split.cpp Outdated
Comment thread src/tools/wasm-split/wasm-split.cpp
When the first line of the manifest file is blank, currFuncs is null,
but will be dereferenced to check if the current module will be empty.

This CL fixes that and also cleans up the logic to clarify how the
state machine works.

This branch has not been deployed

No deployments
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