Hello community,

here is the log from the commit of package enchant for openSUSE:Factory checked 
in at 2020-11-09 13:57:02
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/enchant (Old)
 and      /work/SRC/openSUSE:Factory/.enchant.new.11331 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "enchant"

Mon Nov  9 13:57:02 2020 rev:39 rq:846472 version:2.2.8

Changes:
--------
--- /work/SRC/openSUSE:Factory/enchant/enchant.changes  2020-09-09 
17:49:51.922569079 +0200
+++ /work/SRC/openSUSE:Factory/.enchant.new.11331/enchant.changes       
2020-11-09 13:58:23.295836278 +0100
@@ -1,0 +2,6 @@
+Thu Nov  5 17:11:26 UTC 2020 - Timo Jyrinki <tjyri...@suse.com>
+
+- Backport from upstream git a Voikko backend fix (bsc#1178489)
+  + Add Fix_back-ends_that_want_a_NUL-terminated_string.patch
+
+-------------------------------------------------------------------

New:
----
  Fix_back-ends_that_want_a_NUL-terminated_string.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ enchant.spec ++++++
--- /var/tmp/diff_new_pack.b3skIj/_old  2020-11-09 13:58:23.815835144 +0100
+++ /var/tmp/diff_new_pack.b3skIj/_new  2020-11-09 13:58:23.819835135 +0100
@@ -29,6 +29,8 @@
 URL:            https://abiword.github.io/enchant/
 Source:         
https://github.com/AbiWord/%{name}/releases/download/v%{version}/%{name}-%{version}.tar.gz
 Source1:        baselibs.conf
+# PATCH-FIX-UPSTREAM Fix_back-ends_that_want_a_NUL-terminated_string.patch 
bsc#1178489 -- fix voikko backend in eg gspell
+Patch0:         Fix_back-ends_that_want_a_NUL-terminated_string.patch
 BuildRequires:  aspell-devel
 BuildRequires:  dbus-1-glib-devel
 BuildRequires:  gcc-c++
@@ -127,6 +129,7 @@
 
 %prep
 %setup -q
+%patch0 -p1
 
 %build
 %configure \

++++++ Fix_back-ends_that_want_a_NUL-terminated_string.patch ++++++
>From 7e729f1fda553ad3e2dceb0d362f07e161a9615e Mon Sep 17 00:00:00 2001
From: Reuben Thomas <r...@sc3d.org>
Date: Thu, 15 Oct 2020 15:16:32 +0100
Subject: [PATCH] Fix back-ends that want a NUL-terminated string (fix #259)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Voikko and Zemberek’s APIs assume a NUL-terminated string. Enchant does not
guarantee to provide one, so copy and NUL-terminate the provided string in
the check methods.
---
 providers/enchant_voikko.c     | 12 ++++++++----
 providers/enchant_zemberek.cpp | 14 ++++++++++----
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/providers/enchant_voikko.c b/providers/enchant_voikko.c
index 4b82395..8c5cfa8 100644
--- a/providers/enchant_voikko.c
+++ b/providers/enchant_voikko.c
@@ -48,9 +48,11 @@
  */
 
 static int
-voikko_dict_check (EnchantDict * me, const char *const word, size_t len 
_GL_UNUSED_PARAMETER)
+voikko_dict_check (EnchantDict * me, const char *const word, size_t len)
 {
-       int result = voikkoSpellCstr((struct VoikkoHandle *)me->user_data, 
word);
+       char *word_nul = strndup(word, len);
+       int result = voikkoSpellCstr((struct VoikkoHandle *)me->user_data, 
word_nul);
+       free(word_nul);
        if (result == VOIKKO_SPELL_FAILED)
                return 1;
        else if (result == VOIKKO_SPELL_OK)
@@ -61,9 +63,11 @@ voikko_dict_check (EnchantDict * me, const char *const word, 
size_t len _GL_UNUS
 
 static char **
 voikko_dict_suggest (EnchantDict * me, const char *const word,
-                    size_t len _GL_UNUSED_PARAMETER, size_t * out_n_suggs)
+                    size_t len, size_t * out_n_suggs)
 {
-       char **voikko_sugg_arr = voikkoSuggestCstr((struct VoikkoHandle 
*)me->user_data, word);
+       char *word_nul = strndup(word, len);
+       char **voikko_sugg_arr = voikkoSuggestCstr((struct VoikkoHandle 
*)me->user_data, word_nul);
+       free(word_nul);
        if (voikko_sugg_arr == NULL)
                return NULL;
        for (*out_n_suggs = 0; voikko_sugg_arr[*out_n_suggs] != NULL; 
(*out_n_suggs)++);
diff --git a/providers/enchant_zemberek.cpp b/providers/enchant_zemberek.cpp
index 83a895a..49ddfd7 100644
--- a/providers/enchant_zemberek.cpp
+++ b/providers/enchant_zemberek.cpp
@@ -142,18 +142,24 @@ extern "C" {
 EnchantProvider *init_enchant_provider(void);
 
 static int
-zemberek_dict_check (EnchantDict * me, const char *const word, size_t len 
_GL_UNUSED_PARAMETER)
+zemberek_dict_check (EnchantDict * me, const char *const word, size_t len)
 {
     Zemberek *checker = (Zemberek *) me->user_data;
-    return checker->checkWord(word);
+    char *word_nul = g_strndup(word, len);
+    int result = checker->checkWord(word_nul);
+    free(word_nul);
+    return result;
 }
 
 static char**
 zemberek_dict_suggest (EnchantDict * me, const char *const word,
-                       size_t len _GL_UNUSED_PARAMETER, size_t * out_n_suggs)
+                       size_t len, size_t * out_n_suggs)
 {
     Zemberek *checker = (Zemberek *) me->user_data;
-    return checker->suggestWord (word, out_n_suggs);
+    char *word_nul = g_strndup(word, len);
+    char **result = checker->suggestWord(word_nul, out_n_suggs);
+    free(word_nul);
+    return result;
 }
 
 static void

Reply via email to