Skip to content

fix: harden terronnd wasm gauge - #10908

Merged
Saschl merged 3 commits into
flybywiresim:masterfrom
Saschl:fix/terr-wasm
Sep 5, 2026
Merged

fix: harden terronnd wasm gauge#10908
Saschl merged 3 commits into
flybywiresim:masterfrom
Saschl:fix/terr-wasm

Conversation

@Saschl

@Saschl Saschl commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Fixes #[issue_no]

Summary of Changes

As we encounter some wasm crashes in the terrain module recently (hard to reproduce) I checked the code to find some possible trigger points (Claude assisted).

  • Adds some sanity checks before reserving memory (will definitely crash if expectedBytes is a bogus number that comes from Simbridge via simconnect)
  • Discard potential garbage data (e.g. if more is sent than expected)
  • Fix potential UB in vector handling

Sorry for the formatting change. I adapted the formatting file to use the same rules as the FBW gauges now.

Cockpit API Changes

Screenshots (if necessary)

References

Additional context

Discord username (if different from GitHub):

Testing instructions

  • Launch Plane and Simbridge and ensure the terrain display still works and updates
  • Verify the gauge does not crash (ND turns orange in this case)

How to download the PR for QA

Every new commit to this PR will cause new A32NX and A380X artifacts to be created, built, and uploaded.

  1. Make sure you are signed in to GitHub
  2. Click on the Checks tab on the PR
  3. On the left side, find and click on the PR Build tab
  4. Click on either flybywire-aircraft-a320-neo or flybywire-aircraft-a380-842 download link at the bottom of the page

@github-project-automation github-project-automation Bot moved this to 🟡 Code Review: Ready for Review in Quality Assurance Aug 28, 2026
@github-actions github-actions Bot added the MSFS2024 Issues & PRs for MSFS2024 label Aug 28, 2026
void reserve(std::size_t expectedByteCount) {
this->_expectedByteCount = expectedByteCount;
this->_content.reserve(expectedByteCount);
this->_content.resize(expectedByteCount);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Not entirely sure if this was an issue, but as size never gets initialized with reserve, the later usage with memcpy and the underlying pointer is not really defined when size = 0.

Image

@github-project-automation github-project-automation Bot moved this from 🟡 Code Review: Ready for Review to 🟣 QA Review: Ready to Test in Quality Assurance Aug 31, 2026
@BravoMike99

Copy link
Copy Markdown
Contributor

Dev team QA report

Discord Username : bruno_pt99
Object of testing : #10908
Aircraft : A32NX
Simulator : 2024
Tier of Testing : 1
Date : 05/09/2026

Testing Process:
Turned on TERR on ND, switched ranges and modes on the ND and terrain kept working normally.

Testing Results:
Passed

@Saschl
Saschl enabled auto-merge (squash) September 5, 2026 16:15
@Saschl
Saschl merged commit 5702838 into flybywiresim:master Sep 5, 2026
10 checks passed
@github-project-automation github-project-automation Bot moved this from 🟣 QA Review: Ready to Test to ✔️ Done in Quality Assurance Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

MSFS2024 Issues & PRs for MSFS2024 QA Passed

Projects

Status: ✔️ Done

Development

Successfully merging this pull request may close these issues.

3 participants