[26] WKDateTimePicker SetForScope writes to freed self
Rated Medium because the diff fixes a UAF in the UI process: a
SetForScopeRAII guard tied to_isDismissingDatePickeroutlivedselfwhen[_datePickerController dismissViewControllerAnimated:NO completion:nil]re-entered runloop work that dropped the last reference to theWKDateTimePicker, then wroteNOinto freed memory at scope exit.
Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm
Use-after-free via RAII scope-guard outliving its enclosing object across an Objective-C re-entrancy boundary.
Three call sites wrapped: removeDatePickerPresentation, plus WKFormPeripheralBase's beginEditing/endEditing for the same controlBeginEditing/controlEndEditing shape. WKDatePickerPopoverController.mm similarly protects a __weak _delegate.
RAII scope guards bound to instance members are a quiet recurring Objective-C++ footgun: C++ enforces RAII destruction order, but Objective-C reference counting doesn't protect the receiver across a synchronous method call. Every SetForScope { self->_member, ... } inside a method that calls into UIKit, delegates, or callback-bearing APIs is a latent UAF unless the receiver is independently retained.
This vulnerability weakens memory safety inside the UI process — more privileged than WebContent and outside the renderer sandbox.
Audit directions
SetForScopein-[]methods bracketing synchronous Objective-C calls. GrepSetForScope.*_followed within scope by[_or[selfinSource/WebKit/UIProcess/ios/. Verify receiver isprotect(...)-retained or held by localRetainPtr.- Synchronous UIKit calls invoked from IPC handlers. Audit
dismissViewController,endEditing:,resignFirstResponder,removeFromSuperviewon member ivars withoutprotect(...)in sibling form-peripheral classes (WKFormSelectControl, WKFormColorControl, WKFormInputSession). __weakivars dereferenced multiple times in one method. Each access is an independent load that can race with dealloc.- Stack-allocated RAII whose destructor depends on
self. CheckTemporaryChange,makeScopeExit([this]{...}), and any captured-thiscleanup inside Objective-C methods.