From c28fcd26c1ab7c5d2dcde9597c0678ade1b05c35 Mon Sep 17 00:00:00 2001 From: Yves Biener Date: Fri, 28 Feb 2025 15:55:10 +0100 Subject: [PATCH] fix(container/layout): integer overflows by casting to `usize` --- src/container.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/container.zig b/src/container.zig index a2ffe29..33cb5d4 100644 --- a/src/container.zig +++ b/src/container.zig @@ -346,8 +346,8 @@ pub const Layout = packed struct { for (0..children.len - 1) |idx| { const child = children[idx]; const anchor = switch (this.direction) { - .horizontal => ((child.size.anchor.row -| size.anchor.row) * size.cols) + child.size.anchor.col + child.size.cols + gap -| size.anchor.col, - .vertical => ((child.size.anchor.row + child.size.rows + gap -| size.anchor.row) * size.cols) + child.size.anchor.col -| size.anchor.col, + .horizontal => ((@as(usize, child.size.anchor.row) -| @as(usize, size.anchor.row)) * @as(usize, size.cols)) + @as(usize, child.size.anchor.col) + @as(usize, child.size.cols) + gap -| @as(usize, size.anchor.col), + .vertical => ((@as(usize, child.size.anchor.row) + @as(usize, child.size.rows) + gap -| @as(usize, size.anchor.row)) * @as(usize, size.cols)) + @as(usize, child.size.anchor.col) -| @as(usize, size.anchor.col), }; switch (this.direction) {