[libcxx-commits] [libcxx] [libc++][hardening] Classify assertions related to leaks and syscalls. (PR #77164)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Jan 7 05:18:10 PST 2024
================
@@ -668,7 +668,9 @@ path __read_symlink(const path& p, error_code* ec) {
detail::SSizeT ret;
if ((ret = detail::readlink(p.c_str(), buff.get(), size)) == -1)
return err.report(capture_errno());
- _LIBCPP_ASSERT_UNCATEGORIZED(ret > 0, "TODO");
+ // `ret` indicates the number of bytes written to the buffer, `0` means that the attempt to read the symlink produced
+ // an empty string.
+ _LIBCPP_ASSERT_VALID_EXTERNAL_API_CALL(ret > 0, "TODO");
----------------
mordante wrote:
I also wonder how often these can trigger when an end-user deletes a file the application was using. AFAIK we don't enable these assertions in the dylib so at the moment they are unchecked. Right?
I also how many of these can be solved by throwing an exception. Obviously that requires validating the functions against the WP.
https://github.com/llvm/llvm-project/pull/77164
More information about the libcxx-commits
mailing list