[debian-edu-commits] debian-edu/ 37/50: d/p/004-gcc5-compatibility.diff: Add a patch from upstream fixing GCC5 compatibility.

Unit 193 unit193-guest at moszumanska.debian.org
Wed Dec 21 05:06:11 UTC 2016


This is an automated email from the git hooks/post-receive script.

unit193-guest pushed a commit to branch master
in repository veracrypt.

commit ccda46ad88850f741f8e7e6e46d752b28de8e375
Author: Unit 193 <unit193 at ubuntu.com>
Date:   Fri Mar 18 16:58:57 2016 -0400

    d/p/004-gcc5-compatibility.diff: Add a patch from upstream fixing GCC5 compatibility.
---
 debian/patches/004-gcc5-compatibility.diff | 54 ++++++++++++++++++++++++++++++
 debian/patches/series                      |  1 +
 2 files changed, 55 insertions(+)

diff --git a/debian/patches/004-gcc5-compatibility.diff b/debian/patches/004-gcc5-compatibility.diff
new file mode 100644
index 0000000..b64bbb6
--- /dev/null
+++ b/debian/patches/004-gcc5-compatibility.diff
@@ -0,0 +1,54 @@
+From 646679da4d79bf7f8af22c44c7ae8498086a88a6 Mon Sep 17 00:00:00 2001
+From: Mounir IDRASSI <mounir.idrassi at 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.
+
+---
+ src/Platform/Unix/Process.cpp | 24 ++++++++++++++++++++++--
+ 1 file changed, 22 insertions(+), 2 deletions(-)
+
+diff --git a/src/Platform/Unix/Process.cpp b/src/Platform/Unix/Process.cpp
+index 388bda6..0770364 100644
+--- a/src/Platform/Unix/Process.cpp
++++ b/src/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)
diff --git a/debian/patches/series b/debian/patches/series
index 2694b0b..c7b7c51 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 001-user-guide-location.diff
 002-build-flags.diff
 003-indicator-support.diff
+004-gcc5-compatibility.diff

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/veracrypt.git



More information about the debian-edu-commits mailing list