From a502593fd97ab30a4d0044816e5c3dd3b302fb64 Mon Sep 17 00:00:00 2001 From: soypat Date: Fri, 13 May 2022 19:53:40 -0300 Subject: [PATCH] fix WriteSTL overflow on 32bit machines --- render/stl.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/render/stl.go b/render/stl.go index c27816e..2764ed2 100644 --- a/render/stl.go +++ b/render/stl.go @@ -23,7 +23,8 @@ func WriteSTL(w io.Writer, model []Triangle3) error { if len(model) == 0 { return errors.New("empty triangle slice") } - nt := len(model) + + nt := int64(len(model)) // int64 cast so that next line works correctly on 32bit machines. if nt > math.MaxUint32 { return errors.New("amount of triangles in model exceeds STL design limits") }