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

Patch by Basuke Suzuki <Basuke.Suzuki@sony.com> 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):

Canonical link: https://commits.webkit.org/196488@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225668 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
basuke authored and webkit-commit-queue committed Dec 8, 2017
1 parent 992676f commit 50e2d42a7749272a4ab53668b2cb2eeb42e6d986
Showing 2 changed files with 16 additions and 1 deletion.
@@ -1,3 +1,18 @@
2017-12-07 Basuke Suzuki <Basuke.Suzuki@sony.com>

[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 <utatane.tea@gmail.com>

Use WTF Locking primitives in WebThread and drop pthread_xxx use
@@ -74,7 +74,7 @@ void BitVector::clearAll()

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;

0 comments on commit 50e2d42

Please sign in to comment.