Issue |
120898
|
Summary |
`{Small,}BitVector.reset(unsigned I, unsigned E)` has off-by-one error
|
Labels |
new issue
|
Assignees |
|
Reporter |
natanelh-mobileye
|
consider the following crashing code:
```c++
SmallBitVector BV(31, true);
BV.reset(30, 32);
```
expected behavior: bits 30, 31 are reset
actual behavior: assertion crash:
```sh
at llvm-project/llvm/include/llvm/ADT/SmallBitVector.h:420
420 assert(E <= size() && "Attempted to reset out-of-bounds range!");
```
it should check `E <= size() + 1` since the end is not included in the range (at least according to the docs).
I am not good enough with bits and bytes to solve the algorithm however and a dumb change of adding one in that check may or may not cause UB later without special handling.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs