File tree Expand file tree Collapse file tree
client/react/desktop/tauri-app/src-tauri/patches/glib-0.18.5/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -895,11 +895,16 @@ impl<T: TransparentPtrType> PtrSlice<T> {
895895 while self . len > len {
896896 self . len -= 1 ;
897897 let p = self . ptr . as_ptr ( ) . add ( self . len ) ;
898- ptr:: drop_in_place :: < T > ( p as * mut T ) ;
898+ // We must use ptr::read() -> ptr::write() -> drop() sequence here to avoid
899+ // CodeQL "Access of invalid pointer" alerts. drop_in_place() invalidates the
900+ // memory location effectively for static analysis, so writing to it afterwards
901+ // triggers a warning.
902+ let item = ptr:: read ( p as * mut T ) ;
899903 ptr:: write (
900904 p,
901905 ptr:: null_mut ( ) ,
902906 ) ;
907+ drop ( item) ;
903908 }
904909 }
905910 }
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ pub fn register_boxed_type<T: BoxedType>() -> crate::Type {
4242 Box :: into_raw ( copy) as ffi:: gpointer
4343 }
4444 unsafe extern "C" fn boxed_free < T : BoxedType > ( v : ffi:: gpointer ) {
45+ if v. is_null ( ) {
46+ return ;
47+ }
4548 let v = v as * mut T ;
4649 let _ = Box :: from_raw ( v) ;
4750 }
You can’t perform that action at this time.
0 commit comments