We were unconditionally passing an assume_init() value to status_to_io_result(), which would only return that value back if there was no error. This is UB if the MaybeUninit was never written to, which is typically the case when an error is returned. Instead a .map(|()| ...assume_init()) should be used to ensure we only move the MaybeUninit into an initialized Rust value when the error code says it is okay to do so.
As this is the only place where a non-void (()) value was passed to status_to_io_result(), the value: T argument has been removed in favour of always returning () just like the BitmapError::from_status() and MediaError::from_status() APIs.
We were unconditionally passing an
assume_init()
value tostatus_to_io_result()
, which would only return that value back if there was no error. This is UB if theMaybeUninit
was never written to, which is typically the case when an error is returned. Instead a.map(|()| ...assume_init())
should be used to ensure we only move theMaybeUninit
into an initialized Rust value when the error code says it is okay to do so.As this is the only place where a non-void (
()
) value was passed tostatus_to_io_result()
, thevalue: T
argument has been removed in favour of always returning()
just like theBitmapError::from_status()
andMediaError::from_status()
APIs.