49903c96
Widen readbackOffscreen assert to usize
a73x 2026-04-17 16:38
Prevents silent u32 overflow on width*height*4 for large targets. Not reachable at current 80x24 call sites, but matches the usize semantics of the slice length it compares against. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
diff --git a/src/renderer.zig b/src/renderer.zig index 0d67a9b..ce9008e 100644 --- a/src/renderer.zig +++ b/src/renderer.zig @@ -1922,7 +1922,7 @@ pub const Context = struct { out_rgba: []u8, ) !void { std.debug.assert(target.format == .b8g8r8a8_unorm); // swizzle below assumes BGRA8 std.debug.assert(out_rgba.len == target.width * target.height * 4); std.debug.assert(out_rgba.len == @as(usize, target.width) * @as(usize, target.height) * 4); if (out_rgba.len < target.readback_size) return error.BufferTooSmall; const mapped = try self.vkd.mapMemory(