diff options
author | Aapo Alasuutari <aapo.alasuutari@gmail.com> | 2022-08-05 19:26:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-05 21:56:54 +0530 |
commit | 569910856e648e8cdaad85916eb82fea3c75ed8b (patch) | |
tree | 8d6619ce0067b6c7bab12103d509367256aa8387 /test_ffi/src/lib.rs | |
parent | 6e6912489cc0bf5f661c1940691fcec5879e1f80 (diff) |
fix(ext/ffi): Check CStr for UTF-8 validity on read (#15318)
Co-authored-by: Phosra <phosra@tutanota.com>
Diffstat (limited to 'test_ffi/src/lib.rs')
-rw-r--r-- | test_ffi/src/lib.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test_ffi/src/lib.rs b/test_ffi/src/lib.rs index b061ca8d5..08ef7cb7f 100644 --- a/test_ffi/src/lib.rs +++ b/test_ffi/src/lib.rs @@ -411,3 +411,10 @@ static STRING: &str = "Hello, world!\0"; 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] = [ + 0xC0, 0xC1, 0xF5, 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, + 0x00, +]; |