Title: [246072] trunk/Source/WebCore
Revision
246072
Author
[email protected]
Date
2019-06-04 10:59:51 -0700 (Tue, 04 Jun 2019)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (246071 => 246072)


--- trunk/Source/WebCore/ChangeLog	2019-06-04 17:56:59 UTC (rev 246071)
+++ trunk/Source/WebCore/ChangeLog	2019-06-04 17:59:51 UTC (rev 246072)
@@ -1,3 +1,29 @@
+2019-06-04  Keith Rollin  <[email protected]>
+
+        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):
+
 2019-06-02  Antoine Quint  <[email protected]>
 
         [Pointer Events] Expose navigator.maxTouchPoints

Modified: trunk/Source/WebCore/page/PointerCaptureController.cpp (246071 => 246072)


--- trunk/Source/WebCore/page/PointerCaptureController.cpp	2019-06-04 17:56:59 UTC (rev 246071)
+++ trunk/Source/WebCore/page/PointerCaptureController.cpp	2019-06-04 17:59:51 UTC (rev 246072)
@@ -34,6 +34,7 @@
 #include "EventTarget.h"
 #include "Page.h"
 #include "PointerEvent.h"
+#include <wtf/CheckedArithmetic.h>
 
 #if ENABLE(POINTER_LOCK)
 #include "PointerLockController.h"
@@ -133,7 +134,8 @@
             // When the pointer capture target override is no longer connected, the pending pointer capture target override and pointer capture target
             // override nodes SHOULD be cleared and also a PointerEvent named lostpointercapture corresponding to the captured pointer SHOULD be fired
             // at the document.
-            auto pointerId = keyAndValue.key;
+            ASSERT(WTF::isInBounds<PointerID>(keyAndValue.key));
+            auto pointerId = static_cast<PointerID>(keyAndValue.key);
             auto pointerType = capturingData.pointerType;
             releasePointerCapture(&element, pointerId);
             element.document().enqueueDocumentEvent(PointerEvent::create(eventNames().lostpointercaptureEvent, pointerId, pointerType));
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to