diff options
author | Timo Teräs <timo.teras@iki.fi> | 2016-11-18 15:32:03 +0000 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2016-11-18 15:32:03 +0000 |
commit | f364a4d7430c1e6a4aa443d7316cc4fe0ede88a1 (patch) | |
tree | ee4303a94c060c274f30c35cc6476d59466d0e32 /main/truecrypt/fix-invalid-characters.patch | |
parent | ec606a0582199dff8f92c22e2bfa5c77a55c5d61 (diff) | |
download | aports-f364a4d7430c1e6a4aa443d7316cc4fe0ede88a1.tar.bz2 aports-f364a4d7430c1e6a4aa443d7316cc4fe0ede88a1.tar.xz |
main/truecrypt: add gcc6 related fix
Diffstat (limited to 'main/truecrypt/fix-invalid-characters.patch')
-rw-r--r-- | main/truecrypt/fix-invalid-characters.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/main/truecrypt/fix-invalid-characters.patch b/main/truecrypt/fix-invalid-characters.patch new file mode 100644 index 0000000000..f8e54f31dc --- /dev/null +++ b/main/truecrypt/fix-invalid-characters.patch @@ -0,0 +1,54 @@ +From 646679da4d79bf7f8af22c44c7ae8498086a88a6 Mon Sep 17 00:00:00 2001 +From: Mounir IDRASSI <mounir.idrassi@idrix.fr> +Date: Fri, 18 Mar 2016 16:25:48 +0100 +Subject: [PATCH] Linux: Completely fix gcc-5 "Invalid characters encountered" + issue on mount. It was caused by an issue of gcc-5 STL implementation that is + causing char* pointers retrieved from std::string using c_str method to + become invalid in the child of a child process (after two fork calls). The + workaround is to first copy the std:string values in the child before calling + the second fork. + +--- + Platform/Unix/Process.cpp | 24 ++++++++++++++++++++++-- + 1 file changed, 22 insertions(+), 2 deletions(-) + +diff --git a/Platform/Unix/Process.cpp b/Platform/Unix/Process.cpp +index 388bda6..0770364 100644 +--- a/Platform/Unix/Process.cpp ++++ b/Platform/Unix/Process.cpp +@@ -53,13 +53,33 @@ namespace VeraCrypt + try + { + int argIndex = 0; ++ /* Workaround for gcc 5.X issue related to the use of STL (string and list) with muliple fork calls. ++ * ++ * The char* pointers retrieved from the elements of parameter "arguments" are no longer valid after ++ * a second fork is called. "arguments" was created in the parent of the current child process. ++ * ++ * The only solution is to copy the elements of "arguments" parameter in a local string array on this ++ * child process and then use char* pointers retrieved from this local copies before calling fork. ++ * ++ * gcc 4.x doesn't suffer from this issue. ++ * ++ */ ++ string argsCopy[array_capacity (args)]; + if (!execFunctor) +- args[argIndex++] = const_cast <char*> (processName.c_str()); ++ { ++ argsCopy[argIndex++] = processName; ++ } + + foreach (const string &arg, arguments) + { +- args[argIndex++] = const_cast <char*> (arg.c_str()); ++ argsCopy[argIndex++] = arg; + } ++ ++ for (int i = 0; i < argIndex; i++) ++ { ++ args[i] = const_cast <char*> (argsCopy[i].c_str()); ++ } ++ + args[argIndex] = nullptr; + + if (inputData) |