You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CFRunLoop methods add_timer, remove_timercontains_source, add_source, remove_source, contains_observer, add_observer, remove_observer accept an argument mode of type CFRunLoopMode, which is a type alias for *const __CFString. This parameter is passed on to the underlying functions which dereference it, so these methods are unsound because nothing prevents safe code from passing an invalid pointer.
I confirmed that the following line without unsafe segfaults:
Ironically, correct usage requires unsafe, because the kCFRunLoopDefaultMode and kCFRunLoopCommonModes that are normally passed here are extern statics that requires unsafe to access.
The text was updated successfully, but these errors were encountered:
kevinmehall
added a commit
to kevinmehall/core-foundation-rs
that referenced
this issue
Dec 4, 2023
The CFRunLoop methods
add_timer
,remove_timer
contains_source
,add_source
,remove_source
,contains_observer
,add_observer
,remove_observer
accept an argumentmode
of typeCFRunLoopMode
, which is a type alias for*const __CFString
. This parameter is passed on to the underlying functions which dereference it, so these methods are unsound because nothing prevents safe code from passing an invalid pointer.I confirmed that the following line without
unsafe
segfaults:Ironically, correct usage requires
unsafe
, because thekCFRunLoopDefaultMode
andkCFRunLoopCommonModes
that are normally passed here areextern static
s that requiresunsafe
to access.The text was updated successfully, but these errors were encountered: