Fixes Null-dereference READ in blink::HTMLAnchorElement::HandleClick
This is a regression introduced by my fix to HTMLAnchorElement when the <a>, with embedded inline element, is placed inside a <summary> tag. https://chromium.googlesource.com/chromium/src/+/4eb4df63f17ee0f22cd17472fa6ae92311e49900 The regression is caught by fuzz test: https://clusterfuzz.com/download?testcase_id=4577041865113600. The fuzz test create a click event on the document object which gets handled by node.cc::DefaultEventHandler(). It creates an DOMActivate event and propagate down to HTMLAreaElement. However, the event target is set to NULL by dom/events/event_dispatcher.cc. https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/dom/events/event_dispatcher.cc?q=event_dispatcher.cc&sq=package:chromium&dr&l=391 Comment indicates the reason is that the event is crossing the shadow DOM boundary. Eventually, inside HTMLAnchorElement::HandleClick -> HTMLAnchorElement::AppendServerMapMousePosition() expects target to be non NULL and Null dereference exception is thrown. The fix is to check the event target for null before handling the underlying event. I went through the call stack to ensure no other event members are needed. I verified that both newly created anchor test and fuzz test pass. Bug: 1029197 Change-Id: I19a3b2811c1d562f4c563bed54ae380d7849b06d Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1945852 Commit-Queue: Yu Han <yuzhehan@chromium.org> Reviewed-by:Kent Tamura <tkent@chromium.org> Reviewed-by:
Mason Freed <masonfreed@chromium.org> Cr-Commit-Position: refs/heads/master@{#721609}
Showing
Please register or sign in to comment