Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 57e8347f3e91ae1766dadd7144f7cf32c5f86fd8
      
https://github.com/WebKit/WebKit/commit/57e8347f3e91ae1766dadd7144f7cf32c5f86fd8
  Author: Zak Ridouh <[email protected]>
  Date:   2026-08-13 (Thu, 13 Aug 2026)

  Changed paths:
    M Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

  Log Message:
  -----------
  [iOS] Null TextIndicator dereferences in position information consumers
https://bugs.webkit.org/show_bug.cgi?id=321322
rdar://184361817

Reviewed by David Kilzer.

InteractionInformationAtPosition::textIndicator is a RefPtr that is only
populated when the request asked for a link indicator and the hit element 
produced one, but
four iOS consumers dereference it unchecked.

-_presentationStyleForPositionInfo:elementInfo: guards only on the
activated element being a link, so a link whose position information carries no 
text indicator
crashes while choosing an action sheet presentation style. 
presentationRectForElementUsingClosestIndicatedRect checks _positionInformation 
but not the indicator inside it. The two UIPreviewItemController callbacks used 
by legacy link preview check neither.

Adopt the shape already used by the correctly-guarded call sites nearby, test 
the RefPtr before dereferencing it, and hoist it into a local where it is used 
more than once, as WKActionSheetAssistant.mm:1068, 
WKContentViewInteraction.mm:10320 and :12009 do.

No new test: reaching these paths requires a link whose position information 
has no text
indicator to arrive at legacy link preview or action sheet presentation, which 
TestWebKitAPI
cannot currently drive on iOS.

* Source/WebKit/UIProcess/ios/WKActionSheetAssistant.mm:
(-[WKActionSheetAssistant presentationRectForElementUsingClosestIndicatedRect]):
(-[WKActionSheetAssistant _presentationStyleForPositionInfo:elementInfo:]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView _presentationSnapshotForPreviewItemController:]):
(-[WKContentView _presentationRectsForPreviewItemController:]):

Canonical link: https://commits.webkit.org/319126@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to