Skip to content

Conversation

@Robbepop
Copy link
Member

@Robbepop Robbepop commented Nov 18, 2025

Closes #1698

cc @tjjfvi Thanks again for your detailed bug report with which I was able to isolate the issue.

After finding the bug it was clear to me why fuzzing couldn't find it and why it is fixed on the new branch.

Why didn't fuzzing find it?

How I found it: I scanned through the meta-information of compiled functions of your repro.wasm file and found a single HUGE function that had more function local constants than its frame size permits.

Fuzzing couldn't find the issue since it only happens for extremely large Wasm functions (>2^15 instructions) where a specific fallback encoding for conditional branch instructions is required. However, fuzzing will never generate Wasm files as huge as needed for this to be found.

What caused the bug?

The bug was that the frame size of a compiled function was computed prior to resolving all the branch offsets. However, for very large functions updating the branch offsets might allocate new function local constants which affect frame sizes.

The new branch removes the fallback encoding for conditional branches and it also removes function local constants - so kinda a double fix.

Usually, I'd add a regression test, however, given that a test testing this would be rather slow and given that this bug cannot occur in this form due to the change in interpreter architecture, I think it is okay to just have the elaborate comment directly in the code.

@codecov
Copy link

codecov bot commented Nov 18, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.63%. Comparing base (afc2f2f) to head (f5ec6e5).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1699      +/-   ##
==========================================
+ Coverage   70.60%   70.63%   +0.03%     
==========================================
  Files         180      180              
  Lines       15338    15338              
==========================================
+ Hits        10829    10834       +5     
+ Misses       4509     4504       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Robbepop Robbepop changed the title Fix issue 1698 fix: update branch offsets before evaluating compiled function frame size Nov 18, 2025
@Robbepop Robbepop merged commit 6c684d2 into main Nov 18, 2025
19 checks passed
@Robbepop Robbepop deleted the rf-fix-issue-1698 branch November 18, 2025 22:03
Robbepop added a commit that referenced this pull request Nov 18, 2025
…size (#1699)

* add test case and improve triggering debug assert

* fix issue-1698

the comment describes the underlying issue.

* remove test because of its massive input file size
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.

IndirectCallToNull trap introduced by new FuncTranslator

2 participants