r16135 - gnucash/trunk/src - Do not change internal scheme strings in place, #389740.
Andreas Köhler
andi5 at cvs.gnucash.org
Tue May 29 12:24:40 EDT 2007
Author: andi5
Date: 2007-05-29 12:24:38 -0400 (Tue, 29 May 2007)
New Revision: 16135
Trac: http://svn.gnucash.org/trac/changeset/16135
Modified:
gnucash/trunk/src/core-utils/core-utils.i
gnucash/trunk/src/core-utils/core-utils.scm
gnucash/trunk/src/import-export/qif-import/qif-file.scm
Log:
Do not change internal scheme strings in place, #389740.
This fixes a crash that happened in the QIF import with Guile 1.8 after
stripping utf8 violating bytes from the internal null-terminated string
of a scheme string, as the length parameter has not been updated and a
safety check threw an error from within a critical section at a later
stage. Just do not wrap gnc_utf8_strip_invalid but rather
gnc_utf8_strip_invalid_strdup.
Modified: gnucash/trunk/src/core-utils/core-utils.i
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.i 2007-05-28 20:44:46 UTC (rev 16134)
+++ gnucash/trunk/src/core-utils/core-utils.i 2007-05-29 16:24:38 UTC (rev 16135)
@@ -19,8 +19,5 @@
void gnc_scm_log_msg(const gchar *);
void gnc_scm_log_debug(const gchar *);
-/* Special treatment because the string changes in place. */
-%typemap(in) gchar * " $1 = SCM_STRING_CHARS($input); "
-%typemap(freearg) gchar * ""
-void gnc_utf8_strip_invalid (gchar *str);
-
+%newobject gnc_utf8_strip_invalid_strdup;
+gchar * gnc_utf8_strip_invalid_strdup(const gchar *);
Modified: gnucash/trunk/src/core-utils/core-utils.scm
===================================================================
--- gnucash/trunk/src/core-utils/core-utils.scm 2007-05-28 20:44:46 UTC (rev 16134)
+++ gnucash/trunk/src/core-utils/core-utils.scm 2007-05-29 16:24:38 UTC (rev 16135)
@@ -11,7 +11,7 @@
(re-export gnc-is-debugging)
(re-export g-find-program-in-path)
-(re-export gnc-utf8-strip-invalid)
+(re-export gnc-utf8-strip-invalid-strdup)
(re-export gnc-scm-log-warn)
(re-export gnc-scm-log-error)
(re-export gnc-scm-log-msg)
Modified: gnucash/trunk/src/import-export/qif-import/qif-file.scm
===================================================================
--- gnucash/trunk/src/import-export/qif-import/qif-file.scm 2007-05-28 20:44:46 UTC (rev 16134)
+++ gnucash/trunk/src/import-export/qif-import/qif-file.scm 2007-05-29 16:24:38 UTC (rev 16135)
@@ -71,8 +71,8 @@
;; pick the 1-char tag off from the remainder of the line
(set! tag (string-ref line 0))
(set! value (substring line 1))
- (gnc-utf8-strip-invalid value) ;; changes value in-place
-
+ (set! value (gnc-utf8-strip-invalid-strdup value))
+
;; now do something with the line
(if
(eq? tag #\!)
More information about the gnucash-changes
mailing list