Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/2710

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/10/2710/1

Resolves: rhbz#918938 crash in danish thesaurus/spell interaction

Change-Id: I911fc382a8e4b895262dcd5ae5c67c4a81e6aad4
---
M hunspell/UnpackedTarball_hunspell.mk
A hunspell/hunspell.rhbz918938.patch
2 files changed, 73 insertions(+), 0 deletions(-)



diff --git a/hunspell/UnpackedTarball_hunspell.mk b/hunspell/UnpackedTarball_hunspell.mk
index 9ba9dc3..1e0544a 100644
--- a/hunspell/UnpackedTarball_hunspell.mk
+++ b/hunspell/UnpackedTarball_hunspell.mk
@@ -19,6 +19,7 @@
        hunspell/hunspell-1.3.2-nullptr.patch \
        hunspell/hunspell-1.3.2-literal.patch \
        hunspell/hunspell-1.3.2-compound.patch \
+       hunspell/hunspell.rhbz918938.patch \
 ))
 
 ifeq ($(COM),MSC)
diff --git a/hunspell/hunspell.rhbz918938.patch b/hunspell/hunspell.rhbz918938.patch
new file mode 100644
index 0000000..8d23503
--- /dev/null
+++ b/hunspell/hunspell.rhbz918938.patch
@@ -0,0 +1,72 @@
+--- misc/hunspell-1.3.2/src/hunspell/hunspell.cxx      2011-02-02 12:04:29.000000000 +0000
++++ misc/build/hunspell-1.3.2/src/hunspell/hunspell.cxx        2013-03-13 16:50:50.667928521 +0000
+@@ -12,6 +12,8 @@
+ #endif
+ #include "csutil.hxx"
+ 
++#include <string>
++
+ Hunspell::Hunspell(const char * affpath, const char * dpath, const char * key)
+ {
+     encoding = NULL;
+@@ -1710,6 +1712,19 @@
+     return n;
+ }
+ 
++namespace
++{
++    void myrep(std::string& str, const std::string& search, const std::string& replace)
++    {
++        size_t pos = 0;
++        while ((pos = str.find(search, pos)) != std::string::npos)
++        {
++           str.replace(pos, search.length(), replace);
++           pos += replace.length();
++        }
++    }
++}
++
+ int Hunspell::spellml(char*** slst, const char * word)
+ {
+   char *q, *q2;
+@@ -1721,26 +1736,26 @@
+   q2 = strstr(q2, "<word");
+   if (!q2) return 0; // bad XML input
+   if (check_xml_par(q, "type=", "analyze")) {
+-      int n = 0, s = 0;
++      int n = 0;
+       if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 10)) n = analyze(slst, cw);
+       if (n == 0) return 0;
+       // convert the result to <code><a>ana1</a><a>ana2</a></code> format
+-      for (int i = 0; i < n; i++) s+= strlen((*slst)[i]);
+-      char * r = (char *) malloc(6 + 5 * s + 7 * n + 7 + 1); // XXX 5*s->&->&amp;
+-      if (!r) return 0;
+-      strcpy(r, "<code>");
++      std::string r;
++      r.append("<code>");
+       for (int i = 0; i < n; i++) {
+-        int l = strlen(r);
+-        strcpy(r + l, "<a>");
+-        strcpy(r + l + 3, (*slst)[i]);
+-        mystrrep(r + l + 3, "\t", " ");
+-        mystrrep(r + l + 3, "<", "&lt;");
+-        mystrrep(r + l + 3, "&", "&amp;");
+-        strcat(r, "</a>");
++        r.append("<a>");
++
++        std::string entry((*slst)[i]);
+         free((*slst)[i]);
++        myrep(entry, "\t", " ");
++        myrep(entry, "<", "&lt;");
++        myrep(entry, "&", "&amp;");
++        r.append(entry);
++
++        r.append("</a>");
+       }
+-      strcat(r, "</code>");
+-      (*slst)[0] = r;
++      r.append("</code>");
++      (*slst)[0] = mystrdup(r.c_str());
+       return 1;
+   } else if (check_xml_par(q, "type=", "stem")) {
+       if (get_xml_par(cw, strchr(q2, '>'), MAXWORDUTF8LEN - 1)) return stem(slst, cw);

-- 
To view, visit https://gerrit.libreoffice.org/2710
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I911fc382a8e4b895262dcd5ae5c67c4a81e6aad4
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Caolán McNamara <caolanm@redhat.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.