We previously called from_bytes_with_nul_unchecked on a buffer that was generated by prost, and not null-terminated. This is undefined behavior; however it coincidentally continued to work as we didn't do anything with this CStr except get a pointer to the first byte.
Because we didn't do much with this CStr, we can completely remove the undefined behavior and fix the problem by just retrieving a pointer to the buffer start directly.
This was originally caught by running tests through AddressSanitizer.
We previously called
from_bytes_with_nul_unchecked
on a buffer that was generated byprost
, and not null-terminated. This is undefined behavior; however it coincidentally continued to work as we didn't do anything with thisCStr
except get a pointer to the first byte.Because we didn't do much with this
CStr
, we can completely remove the undefined behavior and fix the problem by just retrieving a pointer to the buffer start directly.This was originally caught by running tests through
AddressSanitizer
.