Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ext/ffi): Check CStr for UTF-8 validity on read #15318

Merged
merged 14 commits into from
Aug 5, 2022
Prev Previous commit
Next Next commit
Merge branch 'main' into fix-ext-ffi-cstr-check-utf8
  • Loading branch information
aapoalas committed Jul 28, 2022
commit 5c14b247d4b8f584f5954fe21e354c91fc6f07a4
7 changes: 7 additions & 0 deletions test_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,13 @@ pub struct Structure {
#[no_mangle]
pub static mut static_ptr: Structure = Structure { _data: 42 };

static STRING: &str = "Hello, world!\0";

#[no_mangle]
extern "C" fn ffi_string() -> *const u8 {
STRING.as_ptr()
}

/// Invalid UTF-8 characters, array of length 14
#[no_mangle]
pub static static_char: [u8; 14] = [
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.