diff options
author | Eric Carlson <eric.carlson@apple.com> | 2013-08-06 12:12:24 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-08-07 15:49:40 +0200 |
commit | e332e11ed71848e02f79bc9fecb2996f67ef245d (patch) | |
tree | 4ca0d8e014ceb6097ab63cd07ca624fdc33cb7c7 /Source/JavaScriptCore/JavaScriptCorePrefix.h | |
parent | c31ff44d3a17fab37754acb2a0a29cd6eba10699 (diff) | |
download | qtwebkit-e332e11ed71848e02f79bc9fecb2996f67ef245d.tar.gz |
Potential use-after-free with an event fired at a HTMLMediaElement which is currently being deleted
https://bugs.webkit.org/show_bug.cgi?id=117466
Reviewed by Oliver Hunt.
Merge https://chromium.googlesource.com/chromium/blink/+/f4200a0093b3d9376f703961615359ec7fb712b4
If an event is created using as target an HTMLMediaElement which is
currently being deleted it becomes a heap-use-after free situation.
The GenericEventQueue instance is already owned by the HTMLMediaElement,
and there already is an underlying mechanism to set the target of the
event to NULL, if their target is owner of the queue.
In order to avoid creating this reference in the first place, we enqueue
the event with a NULL target to defer the refcount increment until the
timer for dispatching the event happens (which won't happen at all if
garbage collection is already destroying the objects).
Source/WebCore:
Test: media/track/media-element-enqueue-event-crash.html
* dom/GenericEventQueue.cpp:
(WebCore::GenericEventQueue::enqueueEvent): Don't ASSERT if the event has no target.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::~HTMLMediaElement): Close the event queue so it won't try to
dispatch any pending events.
(WebCore::HTMLMediaElement::scheduleEvent): Don't set the event target, it will happen just
prior to event dispatch.
(WebCore::HTMLMediaElement::stop): Close the event queue.
Change-Id: I2b17e9080516036d2a271b204d0925a1a3fb2930
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@151600 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/JavaScriptCorePrefix.h')
0 files changed, 0 insertions, 0 deletions