Skip to content
This repository has been archived by the owner on Aug 12, 2024. It is now read-only.

Commit

Permalink
fix WriteSTL overflow on 32bit machines
Browse files Browse the repository at this point in the history
  • Loading branch information
soypat committed May 13, 2022
1 parent 5df8829 commit a502593
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion render/stl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit a502593

Please sign in to comment.