⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242893 in webkit


Ignore:
Timestamp:
Mar 13, 2019, 11:14:21 AM (7 years ago)
Author:
graouts@webkit.org
Message:

REGRESSION(r240634): Element::hasPointerCapture() passes a JS-controlled value directly into a HashMap as a key
https://bugs.webkit.org/show_bug.cgi?id=195683
<rdar://problem/48659950>

Reviewed by Alex Christensen.

Source/WebCore:

While PointerID is defined as int32_t, we now use int64_t as the key of the HashMap mapping PointerID to CapturingData so that we use
a value outside of the int32_t range as a safe empty and removed values, allowing any int32_t to be provided through the API for
lookup in this HashMap.

Test: pointerevents/pointer-id-crash.html

  • page/PointerCaptureController.h:

LayoutTests:

Add a new test which would crash in debug builds prior to this fix.

  • pointerevents/pointer-id-crash-expected.txt: Added.
  • pointerevents/pointer-id-crash.html: Added.
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242887 r242893  
     12019-03-13  Antoine Quint  <graouts@apple.com>
     2
     3        REGRESSION(r240634): Element::hasPointerCapture() passes a JS-controlled value directly into a HashMap as a key
     4        https://bugs.webkit.org/show_bug.cgi?id=195683
     5        <rdar://problem/48659950>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add a new test which would crash in debug builds prior to this fix.
     10
     11        * pointerevents/pointer-id-crash-expected.txt: Added.
     12        * pointerevents/pointer-id-crash.html: Added.
     13
    1142019-03-13  Shawn Roberts  <sroberts@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r242891 r242893  
     12019-03-13  Antoine Quint  <graouts@apple.com>
     2
     3        REGRESSION(r240634): Element::hasPointerCapture() passes a JS-controlled value directly into a HashMap as a key
     4        https://bugs.webkit.org/show_bug.cgi?id=195683
     5        <rdar://problem/48659950>
     6
     7        Reviewed by Alex Christensen.
     8
     9        While PointerID is defined as int32_t, we now use int64_t as the key of the HashMap mapping PointerID to CapturingData so that we use
     10        a value outside of the int32_t range as a safe empty and removed values, allowing any int32_t to be provided through the API for
     11        lookup in this HashMap.
     12
     13        Test: pointerevents/pointer-id-crash.html
     14
     15        * page/PointerCaptureController.h:
     16
    1172019-03-12  Brady Eidson  <beidson@apple.com>
    218
  • trunk/Source/WebCore/page/PointerCaptureController.h

    r241723 r242893  
    7070
    7171    Page& m_page;
    72     HashMap<PointerID, CapturingData> m_activePointerIdsToCapturingData;
     72    // While PointerID is defined as int32_t, we use int64_t here so that we may use a value outside of the int32_t range to have safe
     73    // empty and removed values, allowing any int32_t to be provided through the API for lookup in this hashmap.
     74    using PointerIdToCapturingDataMap = HashMap<int64_t, CapturingData, WTF::IntHash<int64_t>, WTF::SignedWithZeroKeyHashTraits<int64_t>>;
     75    PointerIdToCapturingDataMap m_activePointerIdsToCapturingData;
    7376};
    7477
Note: See TracChangeset for help on using the changeset viewer.