gwihlidal / meshopt-rs

Rust ffi and idiomatic wrapper for zeux/meshoptimizer, a mesh optimization library that makes indexed meshes more GPU-friendly.
Apache License 2.0
163 stars 33 forks source link

More exhaustive validation in some sanity check modes #8

Closed gwihlidal closed 5 years ago

gwihlidal commented 6 years ago

Some functions pass both an array of indices and vertex count, and there’s an implicit assumption that all indices are in range. In debug this would be “validated” with assertions, but this should be validated when sanity checks are enabled even in release, and safely recover (informing the caller).

We want to protect against all memory safety issues, and throwing a Result error on invalid index data. In addition, encoding.rs has a few assert! macros that should return a Result error instead.