commit | 803e0dc969c82ccb8b82cbca0977d646d2686e79 | [log] [tgz] |
---|---|---|
author | Yegor Pomortsev <ypomortsev@google.com> | Thu Jun 20 15:49:55 2024 -0700 |
committer | Yegor Pomortsev <ypomortsev@google.com> | Wed Jul 17 16:42:30 2024 -0700 |
tree | d944711134149a99995d89095b95c1d64ab96ca8 | |
parent | ceb6f04ecd8f30b97a9e64c0f9e9452828aa8798 [diff] |
libfmq: Fix from_raw_parts UB when used with empty vectors `std::slice::from_raw_parts` has undefined behavior when called with a null pointer and a zero length. This may be the case when the descriptor vectors are empty as `data()` may return a null pointer. Add and use a `slice_from_raw_parts_or_empty` function that returns an empty slice in this case. Test: atest --host libfmq_rust_unit_test Change-Id: I4400939879f224c071d41ad646b036cf77b41df4