diff --git a/0002-Prevent-environment-variables-from-exceeding-NAME_MA.patch b/0002-Prevent-environment-variables-from-exceeding-NAME_MA.patch new file mode 100644 index 0000000000000000000000000000000000000000..ca210c0f281592f8aa3a8b091fed20ea3348a9ee --- /dev/null +++ b/0002-Prevent-environment-variables-from-exceeding-NAME_MA.patch @@ -0,0 +1,30 @@ +From 4673c2eaba443678c4dc6ae74ea16a489b415fed Mon Sep 17 00:00:00 2001 +From: liyunfei +Date: Tue, 19 Sep 2023 09:31:43 +0800 +Subject: [PATCH] Prevent environment variables from exceeding NAME_MAX + +--- + llvm/lib/Support/Unix/Path.inc | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc +index 2ae7c6dc..f13f3165 100644 +--- a/llvm/lib/Support/Unix/Path.inc ++++ b/llvm/lib/Support/Unix/Path.inc +@@ -1427,8 +1427,12 @@ static const char *getEnvTempDir() { + // variable. + const char *EnvironmentVariables[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"}; + for (const char *Env : EnvironmentVariables) { +- if (const char *Dir = std::getenv(Env)) ++ if (const char *Dir = std::getenv(Env)) { ++ if(std::strlen(Dir) > NAME_MAX) { ++ continue; ++ } + return Dir; ++ } + } + + return nullptr; +-- +2.28.0.windows.1 + diff --git a/llvm.spec b/llvm.spec index 3c8979b56fea05ba719b383d47b9d92af84c9e17..9ae49a409c429f958b3ef05012980950e0526957 100644 --- a/llvm.spec +++ b/llvm.spec @@ -35,7 +35,7 @@ Name: %{pkg_name} Version: %{maj_ver}.%{min_ver}.%{patch_ver} -Release: 5 +Release: 6 Summary: The Low Level Virtual Machine License: NCSA @@ -44,6 +44,7 @@ Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{versio Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/cmake-%{version}.src.tar.xz Patch1: 0001-Backport-RISCV-Handle-o-inline-asm-memory-constraint.patch +Patch2: 0002-Prevent-environment-variables-from-exceeding-NAME_MA.patch BuildRequires: binutils-devel BuildRequires: cmake @@ -293,6 +294,9 @@ LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C ./_build %{install_libdir}/libLLVMTestingSupport.a %changelog +* Tue Sep 19 2023 liyunfei - 15.0.7-6 +- Prevent environment variables from exceeding NAME_MAX. + * Wed Aug 9 2023 liyunfei - 15.0.7-5 - Solve opaque pointer issue in Backport testcase.