[PATCH] D124524: [demangler] Avoid nullptr UB
Nathan Sidwell via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 04:39:30 PDT 2022
urnathan added a comment.
In D124524#3486242 <https://reviews.llvm.org/D124524#3486242>, @dblaikie wrote:
> Yeah, I'd go with the fix at memcpy in D122604 <https://reviews.llvm.org/D122604> instead.
>
> I appreciate the argument from `string_view`'s API design - though even `string_view` can be over `nullptr`, but can't be constructed with a null pointer (its default constructor creates a `{nullptr, 0}` `string_view`) so arguably the caller should be able to handle a null `string_view`.
Oh, I'd not noticed that default ctor behavior. I've also looked up to make sure that C++ makes well defined subtracting nullptrs and adding/subbing zero to/from a nullptr. It's just the memcpy issue.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124524/new/
https://reviews.llvm.org/D124524
More information about the llvm-commits
mailing list