[libcxx-commits] [libcxx] [libc++][filesystem] Increase error message buffer size to prevent truncation (PR #203531)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 12 06:48:10 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Zibi Sarbinowski (zibi2)
<details>
<summary>Changes</summary>
The 256-byte buffer in vformat_string was insufficient for filesystem
error messages with long paths, causing truncation on z/OS when paths
exceeded certain lengths. This manifested as test failures in
copy_file.pass.cpp when the --execdir path was long enough that the
formatted error message (which includes paths twice) exceeded 262 chars.
Diagnostic output showed:
Expected message length: 263 characters
Actual message length: 262 characters (missing final ']')
Increasing the buffer to 1024 bytes provides sufficient space for
realistic path lengths while maintaining stack allocation. The existing
fallback to dynamic allocation handles even longer messages if needed.
---
Full diff: https://github.com/llvm/llvm-project/pull/203531.diff
1 Files Affected:
- (modified) libcxx/src/filesystem/format_string.h (+1-1)
``````````diff
diff --git a/libcxx/src/filesystem/format_string.h b/libcxx/src/filesystem/format_string.h
index 8d17b027a6e31..ae43899a162cc 100644
--- a/libcxx/src/filesystem/format_string.h
+++ b/libcxx/src/filesystem/format_string.h
@@ -31,7 +31,7 @@ _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
namespace detail {
inline _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 0) string vformat_string(const char* msg, va_list ap) {
- array<char, 256> buf;
+ array<char, 1024> buf;
va_list apcopy;
va_copy(apcopy, ap);
``````````
</details>
https://github.com/llvm/llvm-project/pull/203531
More information about the libcxx-commits
mailing list