Repository navigation
fix(container): the library builds where usize is 32 bits - #346
Merged
Merged
Conversation
WalkerLimits::permissive and DwgLimits::permissive wrote 4 GiB as a usize product, which overflows on wasm32, i686 and armv7; arithmetic_overflow is deny by default, so checking the dwg library itself for any 32-bit target failed. The wasm crate never saw it, because a lint error in a path dependency is only a warning. The limit now saturates at usize::MAX there, and the Clippy job checks the library for wasm32.
DrunkOnJava
enabled auto-merge (squash)
October 26, 2026 18:36
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
WalkerLimits::permissive().max_scan_bytesandDwgLimits::permissive().max_section_byteswere written as4 * 1024 * 1024 * 1024inusize. On a 32-bit target that product overflows, andarithmetic_overflowis deny by default, so checking or building the dwg library itself for wasm32, i686 or armv7 fails. The WASM workflow never caught it: the wasm crate depends on dwg by path, and there a dependency's lint error is only a warning, sowasm-pack buildsucceeds. The review-fix agent hit it while checking #319's overflow fix on i686.Both limits now go through
saturating_bytes(4 << 30): 4 GiB where it fits,usize::MAXwhereusizeis 32 bits (a 32-bit address space can't hold more anyway). On 64-bit targets the values are unchanged. The Clippy job now also runscargo check --lib --target wasm32-unknown-unknown, so the regression can't return.Spec reference
None; portability (
src/limits.rs).Test plan
cargo check --lib --target wasm32-unknown-unknownon main fails with "error: this arithmetic operation will overflow --> src/limits.rs:250:29 ... attempt to compute4194304_usize * 1024_usize";cd wasm && cargo check --target wasm32-unknown-unknownpasses, which hides it.cargo check --libpasses for wasm32-unknown-unknown and i686-unknown-linux-musl.cargo clippy --all-targets --all-features -- -D warningsandcargo fmt --checkare clean; the existinglimitstests pass (12).Source-provenance declaration
Written for this repository; no external source consulted.