From e380c524ea3dae6de9790e7307419e360ba13061 Mon Sep 17 00:00:00 2001 From: Pavan Kumar Sunkara Date: Tue, 9 Jul 2024 14:10:01 +0000 Subject: [PATCH] Merge pull request #4110 from weiznich/fix/4108 Remove the unsound `SerializedDatabase::new` function --- diesel/src/sqlite/connection/serialized_database.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/diesel/src/sqlite/connection/serialized_database.rs b/diesel/src/sqlite/connection/serialized_database.rs index 8584d9109b09..28a98a286131 100644 --- a/diesel/src/sqlite/connection/serialized_database.rs +++ b/diesel/src/sqlite/connection/serialized_database.rs @@ -13,7 +13,10 @@ pub struct SerializedDatabase { impl SerializedDatabase { /// Creates a new `SerializedDatabase` with the given data pointer and length. - pub fn new(data: *mut u8, len: usize) -> Self { + /// + /// SAFETY: The data pointer needs to be returned by sqlite + /// and the length must match the underlying buffer pointer + pub(crate) unsafe fn new(data: *mut u8, len: usize) -> Self { Self { data, len } }