gnucash maint: Bug 797827 - 4.0.1 gnucash-cli seg faults on macOS Catalina

John Ralls jralls at code.gnucash.org
Sat Jul 11 20:06:23 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/86f7e332 (commit)
	from  https://github.com/Gnucash/gnucash/commit/6ec36dd0 (commit)



commit 86f7e33291cb798b3457fac762c23252608300b7
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Jul 11 17:03:54 2020 -0700

    Bug 797827 - 4.0.1 gnucash-cli seg faults on macOS Catalina
    
    The string references in Gnucash::run_report's run_report_args were
    getting corrupted so either a NULL or invalid filename was passed on
    to the backend. Forcing a copy into run_report_args protects the
    values and allows the report to run.

diff --git a/gnucash/gnucash-commands.cpp b/gnucash/gnucash-commands.cpp
index 5ee2669d8..7552972cf 100644
--- a/gnucash/gnucash-commands.cpp
+++ b/gnucash/gnucash-commands.cpp
@@ -133,11 +133,15 @@ report_session_percentage (const char *message, double percent)
     return;
 }
 
+/* Don't try to use std::string& for the members of the following struct, it
+ * results in the values getting corrupted as it passes through initializing
+ * Scheme when compiled with Clang.
+ */
 struct run_report_args {
-    const std::string& file_to_load;
-    const std::string& run_report;
-    const std::string& export_type;
-    const std::string& output_file;
+    const std::string file_to_load;
+    const std::string run_report;
+    const std::string export_type;
+    const std::string output_file;
 };
 
 static void



Summary of changes:
 gnucash/gnucash-commands.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list