Closed gleb-cloudius closed 3 years ago
I can reproduce this with clang 10.0.0.1, Boost 1.69.0 (on Fedora 32).
It appears that when the container is empty, clear()
takes a null pointer + 1 as the beginning of a loop (a loop which will do nothing because its end is a null pointer as well...), but such arithmetic with null pointer is considered "undefined behavior" in C++.
Many thanks for the report!
This code:
compiled with clang and ubsan
clang++ -fsanitize=undefined
fails with: