Title: [225668] trunk/Source/WTF
Revision
225668
Author
[email protected]
Date
2017-12-07 19:03:19 -0800 (Thu, 07 Dec 2017)

Log Message

[Win] [64-bit] Resolve Microsoft warning C4319 on BitVector.cpp
https://bugs.webkit.org/show_bug.cgi?id=180490

Patch by Basuke Suzuki <[email protected]> on 2017-12-07
Reviewed by Alex Christensen.

bitsInPointer() returns unsigned which is smaller than size_t.
"~"(negate) operator is applied before extending its size which result filled with zero.
This may be potentially a bug if numBits is greater than max value of unsigned long
(which is not practical).

* wtf/BitVector.cpp:
(WTF::BitVector::OutOfLineBits::create):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (225667 => 225668)


--- trunk/Source/WTF/ChangeLog	2017-12-08 03:02:26 UTC (rev 225667)
+++ trunk/Source/WTF/ChangeLog	2017-12-08 03:03:19 UTC (rev 225668)
@@ -1,3 +1,18 @@
+2017-12-07  Basuke Suzuki  <[email protected]>
+
+        [Win] [64-bit] Resolve Microsoft warning C4319 on BitVector.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=180490
+
+        Reviewed by Alex Christensen.
+
+        bitsInPointer() returns unsigned which is smaller than size_t.
+        "~"(negate) operator is applied before extending its size which result filled with zero.
+        This may be potentially a bug if numBits is greater than max value of unsigned long
+        (which is not practical).
+
+        * wtf/BitVector.cpp:
+        (WTF::BitVector::OutOfLineBits::create):
+
 2017-12-07  Yusuke Suzuki  <[email protected]>
 
         Use WTF Locking primitives in WebThread and drop pthread_xxx use

Modified: trunk/Source/WTF/wtf/BitVector.cpp (225667 => 225668)


--- trunk/Source/WTF/wtf/BitVector.cpp	2017-12-08 03:02:26 UTC (rev 225667)
+++ trunk/Source/WTF/wtf/BitVector.cpp	2017-12-08 03:03:19 UTC (rev 225668)
@@ -74,7 +74,7 @@
 
 BitVector::OutOfLineBits* BitVector::OutOfLineBits::create(size_t numBits)
 {
-    numBits = (numBits + bitsInPointer() - 1) & ~(bitsInPointer() - 1);
+    numBits = (numBits + bitsInPointer() - 1) & ~(static_cast<size_t>(bitsInPointer()) - 1);
     size_t size = sizeof(OutOfLineBits) + sizeof(uintptr_t) * (numBits / bitsInPointer());
     OutOfLineBits* result = new (NotNull, fastMalloc(size)) OutOfLineBits(numBits);
     return result;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to