mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
Fix a buffer overrun detected by AddressSanitizer.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@197647 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
33f01f9848
commit
629f3b229e
@ -267,7 +267,8 @@ public:
|
||||
Bits[I / BITWORD_SIZE] = ~0UL;
|
||||
|
||||
BitWord PostfixMask = (1UL << (E % BITWORD_SIZE)) - 1;
|
||||
Bits[I / BITWORD_SIZE] |= PostfixMask;
|
||||
if (I < E)
|
||||
Bits[I / BITWORD_SIZE] |= PostfixMask;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -305,7 +306,8 @@ public:
|
||||
Bits[I / BITWORD_SIZE] = 0UL;
|
||||
|
||||
BitWord PostfixMask = (1UL << (E % BITWORD_SIZE)) - 1;
|
||||
Bits[I / BITWORD_SIZE] &= ~PostfixMask;
|
||||
if (I < E)
|
||||
Bits[I / BITWORD_SIZE] &= ~PostfixMask;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -356,6 +356,12 @@ TYPED_TEST(BitVectorTest, RangeOps) {
|
||||
EXPECT_TRUE( E.test(1));
|
||||
EXPECT_TRUE( E.test(32));
|
||||
EXPECT_FALSE(E.test(33));
|
||||
|
||||
TypeParam BufferOverrun;
|
||||
unsigned size = sizeof(unsigned long) * 8;
|
||||
BufferOverrun.resize(size);
|
||||
BufferOverrun.reset(0, size);
|
||||
BufferOverrun.set(0, size);
|
||||
}
|
||||
|
||||
TYPED_TEST(BitVectorTest, CompoundTestReset) {
|
||||
|
Loading…
Reference in New Issue
Block a user