[M1] Surface ignores get_surface_render_dims failure -> bogus dimensions #22

Closed
opened 2026-06-27 03:54:47 +00:00 by sessamekesh · 0 comments
Owner

File: wasm/src/surface.cc:34-42 (constructor) and 48-62 (Render)

get_surface_render_dims returns bool, but the return value is discarded:

int width = -1, height = -1;
surface_proc_table_.get_surface_render_dims(&width, &height);  // return ignored

On failure width/height stay -1, and static_cast<uint32_t>(-1) = 4294967295 is fed into wgpu::SurfaceConfiguration.

Impact: an invalid/huge surface configuration on any frame where dimension lookup fails (e.g. canvas momentarily detached).

Fix: check the boolean and bail / keep last-known-good dimensions.

Minor (same file): the constructor reads from the parameter surface_proc_table (line 35) while Render reads from the member surface_proc_table_ — harmless but inconsistent.


Filed by an automated AI code review (manual proof-of-concept run). Code locations reference the various-cleanup branch.

**File:** `wasm/src/surface.cc:34-42` (constructor) and `48-62` (`Render`) `get_surface_render_dims` returns `bool`, but the return value is discarded: ```cpp int width = -1, height = -1; surface_proc_table_.get_surface_render_dims(&width, &height); // return ignored ``` On failure `width`/`height` stay `-1`, and `static_cast<uint32_t>(-1)` = 4294967295 is fed into `wgpu::SurfaceConfiguration`. **Impact:** an invalid/huge surface configuration on any frame where dimension lookup fails (e.g. canvas momentarily detached). **Fix:** check the boolean and bail / keep last-known-good dimensions. **Minor (same file):** the constructor reads from the parameter `surface_proc_table` (line 35) while `Render` reads from the member `surface_proc_table_` — harmless but inconsistent. --- _Filed by an automated AI code review (manual proof-of-concept run). Code locations reference the `various-cleanup` branch._
Sign in to join this conversation.
No description provided.