From f59860cea5f674d7ab6daf049c57f39fa84570eb Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sat, 5 Nov 2022 13:30:39 -0700 Subject: [PATCH] earcut: fix potential integer underflow Signed-off-by: Stephen Gutekanst --- libs/earcut/src/main.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/earcut/src/main.zig b/libs/earcut/src/main.zig index f64642b9..d45c5e83 100644 --- a/libs/earcut/src/main.zig +++ b/libs/earcut/src/main.zig @@ -79,6 +79,7 @@ pub fn Processor(comptime T: type) type { /// create a circular doubly linked list from polygon points in the specified winding order fn linkedList(p: *@This(), allocator: Allocator, data: []const T, start: u32, end: u32, dim: u3, clockwise: bool) error{OutOfMemory}!?NodeIndex { + if (data.len < dim) return null; var i: u32 = undefined; var last: ?NodeIndex = null;