https://bugs.llvm.org/show_bug.cgi?id=34729
Bug ID: 34729
Summary: std::string_view encourages use-after-free
Product: libc++
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: All Bugs
Assignee: unassignedclangb...@nondot.org
Reporter: k...@google.com
CC: e...@efcs.ca, llvm-bugs@lists.llvm.org,
mclow.li...@gmail.com
% cat string_view_uaf.cc
#include <iostream>
#include <string>
#include <string_view>
int main() {
std::string s = "Hellooooooooooooooo ";
std::string_view sv = s + "World\n";
std::cout << sv;
}
% clang++ -std=c++11 string_view_uaf.cc -stdlib=libc++ -fsanitize=address &&
./a.out
?ooooooooooooooo World
=================================================================
==15854==ERROR: AddressSanitizer: heap-use-after-free
I don't know if this is a libc++ bug or a C++17 feature, please advise.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs