| Issue |
170687
|
| Summary |
[libc++] Use of invalidated element is not detected for std::deque::pop_front()
|
| Labels |
libc++
|
| Assignees |
AdvenamTacet
|
| Reporter |
ldionne
|
The following code does not trigger an ASAN container overflow issue with `pop_front()`, but does with `pop_back()`:
```c++
#include <deque>
int main(int, char**) {
// with pop_front(): no issue detected
{
std::deque<int> d;
d.push_back(1);
d.push_back(2);
d.push_back(3);
int* first_element = &d[0];
d.pop_front();
*first_element = 42;
}
// with pop_back(): issue detected as we'd expect
{
std::deque<int> d;
d.push_back(1);
d.push_back(2);
d.push_back(3);
int* last_element = &d[2];
d.pop_back();
*last_element = 42;
}
return 0;
}
```
I believe the `pop_front()` usage should trigger an error since the Standard clearly says that references to the erased element are invalidated. Is it possible that there's something wrong with our ASAN container annotations for `std::deque`?
https://godbolt.org/z/odbTYvoKq
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs