fix(core): harden malformed display lists on WebAssembly#200
Conversation
Greptile SummaryThis PR hardens malformed display-list handling and adjusts tests for WebAssembly targets. The main changes are:
Confidence Score: 5/5Safe to merge with minimal risk. The changes are narrow defensive fixes around allocation sizing and test configuration. The updated allocation bounds preserve malformed-buffer rejection by allowing subsequent reads to fail normally. No files require special attention.
What T-Rex did
Important Files Changed
Reviews (2): Last reviewed commit: "fix(core): skip forced parallel test on ..." | Re-trigger Greptile |
Merging this PR will not alter performance
Comparing Footnotes
|
Most conflicts were squash artifacts: main's #226 is the same mean-color density work this branch already carries as commits (main's conflicted spec/client/kernel/test files are byte-identical to this branch's pre-work state), so those resolve to this branch's extended versions. Real incoming changes kept from main: - src/tiles.rs: separable area-weighted compose (#228) — taken wholesale (this branch made no tiles.rs changes beyond the shared #226 content); kernels.rs/lib.rs wasm panic-abort hardening (#200) auto-merged. - README.md: the #230 adoption refresh replaced the inline benchmark table (this branch's only README edit) with links to the launch report, so main's version stands; the 0.1.0 launch-baseline report keeps its historical "density + sample" labels — it records what that release did. Verified on the merged tree: cargo tests, ABI smoke, render smoke, and the full pytest+benchmarks suite — the only failures are 21 doc-contract tests (test_docs_examples/test_verify_local/pyplot perf guardrail) that fail identically on pristine origin/main in this environment: the #230 README rewrite removed maintainer-shortcut text its guardrail tests still assert. Pre-existing on main, not introduced here.
Motivation
Description
Reader::bounded_capacity(count, item_size)to clamp untrusted element counts to the number of complete elements remaining in the unread command buffer and use it for capacity reservations inpts, gradient stop vectors, and dash vectors insrc/raster.rs.raster::tests::malformed_buffer_is_rejected_not_panickedto cover the various count-driven allocation paths (points, gradient stops, stroke dashes, smooth-stroke dashes) so truncation returnsfalseinstead of permitting oversized reservations.#[cfg(panic = "unwind")]and add a clarifying comment toffi_guarddocumenting that panic-abort targets (e.g., wasm32) will abort on internal panics.#[cfg(any(not(target_family = "wasm"), target_feature = "atomics"))]so threadless wasm targets do not attempt unsupported thread spawning.Testing
cargo test, resulting in all tests passing (102 passed, 0 failed) on the host build.cargo test raster::tests::malformed_buffer_is_rejected_not_panicked, which passed.cargo clippy --all-targets -- -D warnings, which completed without warnings.rustup target add wasm32-wasip1 wasm32-wasip1-threadsandcargo check --target wasm32-wasip1*, but target installation/checks could not complete due to inability to download std components fromstatic.rust-lang.orgin the execution environment (network tunnel failure).#142