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

Changeset 246072 in webkit


Ignore:
Timestamp:
Jun 4, 2019, 10:59:51 AM (7 years ago)
Author:
Keith Rollin
Message:

Fix 32-bit/64-bit mismatch in PointerCaptureController::elementWasRemoved
https://bugs.webkit.org/show_bug.cgi?id=198501
<rdar://problem/51370464>

Reviewed by Chris Dumez.

keyAndValue.key is assigned to pointerId. KeyAndValue.key is a
int64_t, whereas pointerId is a PointerID, aka int32_t. This mismatch
is normally just a warning, but breaks builds where warnings are
treated as errors.

This issue is not encountered in most builds because the warning is
disabled in the majority of build configurations. But there are some
where the warning is not disabled, and so those builds break.

Address this conversion error/warning by explicitly casting
keyAndValue.key to a PointerID (and adding a debug check to make sure
the cast is OK).

No new tests -- no new functionality.

  • page/PointerCaptureController.cpp:

(WebCore::PointerCaptureController::elementWasRemoved):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r246070 r246072  
     12019-06-04  Keith Rollin  <krollin@apple.com>
     2
     3        Fix 32-bit/64-bit mismatch in PointerCaptureController::elementWasRemoved
     4        https://bugs.webkit.org/show_bug.cgi?id=198501
     5        <rdar://problem/51370464>
     6
     7        Reviewed by Chris Dumez.
     8
     9        keyAndValue.key is assigned to pointerId. KeyAndValue.key is a
     10        int64_t, whereas pointerId is a PointerID, aka int32_t. This mismatch
     11        is normally just a warning, but breaks builds where warnings are
     12        treated as errors.
     13
     14        This issue is not encountered in most builds because the warning is
     15        disabled in the majority of build configurations. But there are some
     16        where the warning is not disabled, and so those builds break.
     17
     18        Address this conversion error/warning by explicitly casting
     19        keyAndValue.key to a PointerID (and adding a debug check to make sure
     20        the cast is OK).
     21
     22        No new tests -- no new functionality.
     23
     24        * page/PointerCaptureController.cpp:
     25        (WebCore::PointerCaptureController::elementWasRemoved):
     26
    1272019-06-02  Antoine Quint  <graouts@apple.com>
    228
  • trunk/Source/WebCore/page/PointerCaptureController.cpp

    r246061 r246072  
    3535#include "Page.h"
    3636#include "PointerEvent.h"
     37#include <wtf/CheckedArithmetic.h>
    3738
    3839#if ENABLE(POINTER_LOCK)
     
    134135            // override nodes SHOULD be cleared and also a PointerEvent named lostpointercapture corresponding to the captured pointer SHOULD be fired
    135136            // at the document.
    136             auto pointerId = keyAndValue.key;
     137            ASSERT(WTF::isInBounds<PointerID>(keyAndValue.key));
     138            auto pointerId = static_cast<PointerID>(keyAndValue.key);
    137139            auto pointerType = capturingData.pointerType;
    138140            releasePointerCapture(&element, pointerId);
Note: See TracChangeset for help on using the changeset viewer.