google / s2geometry

Computational geometry and spatial indexing on the sphere
http://s2geometry.io/
Apache License 2.0
2.29k stars 302 forks source link

Undefined sanitizer issue #283

Closed MBkkt closed 1 year ago

MBkkt commented 1 year ago

-fsanitize=nullability-arg: Passing null as a function parameter which is annotated with _Nonnull.

https://github.com/google/s2geometry/blob/master/src/s2/util/gtl/compact_array.h#L416

You can add if (old_capacity != 0)

Also if it something like vector with SSO, maybe better to use absl::InlinedVector?

MBkkt commented 1 year ago

https://github.com/google/s2geometry/pull/284

jmr commented 1 year ago

Also if it something like vector with SSO, maybe better to use absl::InlinedVector?

CompactArray also has space optimizations, hence the "Compact".

MBkkt commented 1 year ago

Ok