gnucash maint: Bug 797959 - "Exception" when value greater than one million with...

John Ralls jralls at code.gnucash.org
Tue Oct 13 16:20:18 EDT 2020


Updated	 via  https://github.com/Gnucash/gnucash/commit/c8b725d4 (commit)
	from  https://github.com/Gnucash/gnucash/commit/cca3be7c (commit)



commit c8b725d48a2576d8543663cdb49a9cb37d0a9daf
Author: John Ralls <jralls at ceridwen.us>
Date:   Tue Oct 13 13:17:30 2020 -0700

    Bug 797959 - "Exception" when value greater than one million with...
    
    commas and periods is pasted to register.
    
    Due to a use-after-free, but the underlying idea to remove the commas
    from input to avoid a error dialog because of bad grouping was misguided
    so revert to having the error dialog.

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7b70839f5..1617a1d9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -279,7 +279,7 @@ string(REGEX MATCH "^[0-9]+[.]" SWIG_MAJOR ${SWIG_VERSION})
 
 # guile library and include dir
 pkg_check_modules (GUILE3 guile-3.0 QUIET)
-pkg_check_modules (GUILE22 guile-2.2 QUIET)
+pkg_check_modules (GUILE22 guile-2.2)
 pkg_check_modules (GUILE2 guile-2.0>=2.0.9 QUIET)
 
 if (GUILE3_FOUND) # found guile-3.0
diff --git a/gnucash/register/register-core/pricecell.c b/gnucash/register/register-core/pricecell.c
index 6489e0eab..f6491d57b 100644
--- a/gnucash/register/register-core/pricecell.c
+++ b/gnucash/register/register-core/pricecell.c
@@ -107,23 +107,6 @@ gnc_price_cell_modify_verify (BasicCell *_cell,
             return;
     }
 
-// gnc_basic_cell_set_value_internal doesn't like misplaced thousands separators
-// that can result from deletes, so remove them.
-    for (const char *c = g_utf8_strchr (new_newval, -1, thousands_sep); c;
-         c = g_utf8_strchr (c, -1, thousands_sep))
-    {
-        long len = g_utf8_strlen (new_newval, -1);
-        long pos = g_utf8_pointer_to_offset (new_newval, c);
-        char *start = g_utf8_substring (new_newval, 0, pos);
-        char *end = g_utf8_substring (new_newval, ++pos, len);
-        g_free (new_newval);
-        if (cursor_position && *cursor_position >= pos)
-            --*cursor_position;
-        new_newval = g_strdup_printf ("%s%s", start, end);
-        g_free (start);
-        g_free (end);
-    }
-
     gnc_basic_cell_set_value_internal (_cell, new_newval);
     g_free (new_newval);
     *end_selection = *start_selection = *cursor_position;



Summary of changes:
 CMakeLists.txt                             |  2 +-
 gnucash/register/register-core/pricecell.c | 17 -----------------
 2 files changed, 1 insertion(+), 18 deletions(-)



More information about the gnucash-changes mailing list