earcut: fix potential integer underflow

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-11-05 13:30:39 -07:00
parent a2c6319bc4
commit f59860cea5

View file

@ -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 /// 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 { 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 i: u32 = undefined;
var last: ?NodeIndex = null; var last: ?NodeIndex = null;