Changeset 225668 in webkit


Ignore:
Timestamp:
Dec 7, 2017 7:03:19 PM (6 years ago)
Author:
commit-queue@webkit.org
Message:

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

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r225660 r225668  
     12017-12-07  Basuke Suzuki  <Basuke.Suzuki@sony.com>
     2
     3        [Win] [64-bit] Resolve Microsoft warning C4319 on BitVector.cpp
     4        https://bugs.webkit.org/show_bug.cgi?id=180490
     5
     6        Reviewed by Alex Christensen.
     7
     8        bitsInPointer() returns unsigned which is smaller than size_t.
     9        "~"(negate) operator is applied before extending its size which result filled with zero.
     10        This may be potentially a bug if numBits is greater than max value of unsigned long
     11        (which is not practical).
     12
     13        * wtf/BitVector.cpp:
     14        (WTF::BitVector::OutOfLineBits::create):
     15
    1162017-12-07  Yusuke Suzuki  <utatane.tea@gmail.com>
    217
  • trunk/Source/WTF/wtf/BitVector.cpp

    r173280 r225668  
    7575BitVector::OutOfLineBits* BitVector::OutOfLineBits::create(size_t numBits)
    7676{
    77     numBits = (numBits + bitsInPointer() - 1) & ~(bitsInPointer() - 1);
     77    numBits = (numBits + bitsInPointer() - 1) & ~(static_cast<size_t>(bitsInPointer()) - 1);
    7878    size_t size = sizeof(OutOfLineBits) + sizeof(uintptr_t) * (numBits / bitsInPointer());
    7979    OutOfLineBits* result = new (NotNull, fastMalloc(size)) OutOfLineBits(numBits);
Note: See TracChangeset for help on using the changeset viewer.