sepavloff created this revision. sepavloff added reviewers: rnk, zturner. Herald added subscribers: llvm-commits, hiraditya. Herald added a project: LLVM.
Documentation on CreateProcessW states that maximal size of command line is 32767 characters including ternimation null character. In the function llvm::sys::commandLineFitsWithinSystemLimits this limit was set to 32768. As a result if command line was exactly 32768 characters long, a response file was not created and CreateProcessW was called with too long command line. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D83772 Files: llvm/lib/Support/Windows/Program.inc Index: llvm/lib/Support/Windows/Program.inc =================================================================== --- llvm/lib/Support/Windows/Program.inc +++ llvm/lib/Support/Windows/Program.inc @@ -532,8 +532,13 @@ bool llvm::sys::commandLineFitsWithinSystemLimits(StringRef Program, ArrayRef<StringRef> Args) { - // The documented max length of the command line passed to CreateProcess. - static const size_t MaxCommandStringLength = 32768; + // In the documentation on CreateProcessW: + // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw + // it is stated that the argument lpCommandLine has restriction: + // + // The maximum length of this string is 32,767 characters, including the + // Unicode terminating null character. + static const size_t MaxCommandStringLength = 32767; SmallVector<StringRef, 8> FullArgs; FullArgs.push_back(Program); FullArgs.append(Args.begin(), Args.end());
Index: llvm/lib/Support/Windows/Program.inc =================================================================== --- llvm/lib/Support/Windows/Program.inc +++ llvm/lib/Support/Windows/Program.inc @@ -532,8 +532,13 @@ bool llvm::sys::commandLineFitsWithinSystemLimits(StringRef Program, ArrayRef<StringRef> Args) { - // The documented max length of the command line passed to CreateProcess. - static const size_t MaxCommandStringLength = 32768; + // In the documentation on CreateProcessW: + // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw + // it is stated that the argument lpCommandLine has restriction: + // + // The maximum length of this string is 32,767 characters, including the + // Unicode terminating null character. + static const size_t MaxCommandStringLength = 32767; SmallVector<StringRef, 8> FullArgs; FullArgs.push_back(Program); FullArgs.append(Args.begin(), Args.end());
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits