Repository navigation
Commit 474bb3f
BitSet::setEachNthBit() and clearEachNthBit() loop forever when n is 0
https://bugs.webkit.org/show_bug.cgi?id=328452
rdar://190702141
Reviewed by Yusuke Suzuki.
Both functions advance `index` by `n` inside a do/while loop, so passing
n == 0 never advances the index and the loop never terminates. Passing
n == 0 is a caller error, so add ASSERT(n) to both functions so it fails
immediately in debug builds instead of hanging.
Test: Tools/TestWebKitAPI/Tests/WTF/BitSet.cpp
* Source/WTF/wtf/BitSet.h:
(WTF::WordType>::setEachNthBit):
(WTF::WordType>::clearEachNthBit):
* Tools/TestWebKitAPI/Tests/WTF/BitSet.cpp:
(TestWebKitAPI::TEST(WTF_BitSetDeathTest, MAYBE_ASSERT_ENABLED_DEATH_TEST(SetEachNthBitZero)):
(TestWebKitAPI::TEST(WTF_BitSetDeathTest, MAYBE_ASSERT_ENABLED_DEATH_TEST(ClearEachNthBitZero)):
Canonical link: https://commits.webkit.org/324767@main1 parent fa28e03 commit 474bb3f
2 files changed
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
| 450 | + | |
450 | 451 | | |
451 | 452 | | |
452 | 453 | | |
| |||
482 | 483 | | |
483 | 484 | | |
484 | 485 | | |
| 486 | + | |
485 | 487 | | |
486 | 488 | | |
487 | 489 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| 29 | + | |
| 30 | + | |
29 | 31 | | |
30 | 32 | | |
31 | 33 | | |
| |||
1591 | 1593 | | |
1592 | 1594 | | |
1593 | 1595 | | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
1594 | 1608 | | |
0 commit comments