Files
nearby/presence/implementation
Bryan Kersting 79ae5cab5a Fix unsound Rust reference in np_ffi_CredentialSlab_add_v0_credential
Currently, in the Rust implementation of `np_ffi_CredentialSlab_add_v0_credential`, we take the underlying buffer of the passed `V0MatchableCredential` and turn it into a Rust `&[u8]` by calling `unsafe slice::from_raw_parts`. The safety contract of `from_raw_parts` states that the passed pointer can neither be null, nor be unaligned. In the `advertisment_decoder_rust_impl.cc` we have a code path that leads to a null pointer being passed, though. We get a nullpointer if we pass a `std::vector` of size 0. This change fixes the issue by making sure we always pass a non-null buffer.

PiperOrigin-RevId: 729417182
2025-02-21 00:37:51 -08:00
..
2024-04-29 13:12:45 -07:00
2024-08-30 13:08:35 -07:00
2024-08-30 13:08:35 -07:00