safety-dance
safety-dance copied to clipboard
Audit `iana-time-zone`
As described: https://github.com/strawlab/iana-time-zone/issues/64
This crate is now used by chrono and has become very important in the ecosystem
All these blocks seem documented
$ naive grep -R unsafe *
src/tz_android.rs: let key = unsafe { CStr::from_bytes_with_nul_unchecked(b"persist.sys.timezone\0") };
src/tz_android.rs: unsafe { PROPERTIES = Some(properties) };
src/tz_android.rs: unsafe { PROPERTIES.as_ref() }
src/tz_windows.rs: unsafe { Ok(get_timezone()?) }
src/tz_windows.rs:unsafe fn get_timezone() -> Result<String, HRESULT> {
src/tz_windows.rs:unsafe fn initialize_factory() {
src/tz_windows.rs: unsafe { WindowsDeleteString(string) };
src/tz_windows.rs: unsafe { (*(instance as *mut IUnknown)).Release() };
src/tz_macos.rs: unsafe { get_timezone().ok_or(crate::GetTimezoneError::OsError) }
src/tz_macos.rs:unsafe fn get_timezone() -> Option<String> {
src/tz_macos.rs: unsafe { CFRelease(self.0 as CFTypeRef) };
src/tz_macos.rs: unsafe fn new(v: *const T) -> Option<Self> {
@pinkforest since you've expressed interest in this, just giving you and the safety dance team a heads up that we've significantly refactored the macOS internals if y'all are interested in taking a look. We're gonna let this PR sit until October 6 before merging it:
- https://github.com/strawlab/iana-time-zone/pull/67