mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@16135 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -19,8 +19,5 @@ void gnc_scm_log_error(const gchar *);
|
||||
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 *);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 #\!)
|
||||
|
||||
Reference in New Issue
Block a user