You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Because constructor in std::string that take std::string_view is implicit, this forces developer to be more ... productive.
Problem is that in such case .data() may not be null terminated or may not point to proper string.
Enforce:
Find all calls to std::string_view::data, that are passed to method/function, where other parameter isnt an std::string_view::length/size.
The text was updated successfully, but these errors were encountered:
Because constructor in std::string that take std::string_view is implicit, this forces developer to be more ... productive.
Problem is that in such case .data() may not be null terminated or may not point to proper string.
Enforce:
Find all calls to std::string_view::data, that are passed to method/function, where other parameter isnt an std::string_view::length/size.
PiotrZSL
changed the title
Create bugprone-string-view-data-usage check
[Clang-Tidy] Create bugprone-string-view-data-usage check
Feb 6, 2024
)
This check identifies suspicious usages of std::string_view::data() that
could lead to reading out-of-bounds data due to inadequate or incorrect
string null termination.
Closes#80854
chencha3
pushed a commit
to chencha3/llvm-project
that referenced
this issue
Mar 23, 2024
…m#83716)
This check identifies suspicious usages of std::string_view::data() that
could lead to reading out-of-bounds data due to inadequate or incorrect
string null termination.
Closesllvm#80854
I'm adding this here so, i wouldn't forget.
I run into this issue personally.
Background:
Because constructor in std::string that take std::string_view is implicit, this forces developer to be more ... productive.
Problem is that in such case .data() may not be null terminated or may not point to proper string.
Enforce:
Find all calls to std::string_view::data, that are passed to method/function, where other parameter isnt an std::string_view::length/size.
The text was updated successfully, but these errors were encountered: