diff --git a/hunspell.rhbz918938.patch b/hunspell.rhbz918938.patch new file mode 100644 index 0000000..d29a3f8 --- /dev/null +++ b/hunspell.rhbz918938.patch @@ -0,0 +1,72 @@ +--- src/hunspell/hunspell.cxx 2011-02-02 12:04:29.000000000 +0000 ++++ src/hunspell/hunspell.cxx 2013-03-13 16:50:50.667928521 +0000 +@@ -12,6 +12,8 @@ + #endif + #include "csutil.hxx" + ++#include ++ + 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, "'), MAXWORDUTF8LEN - 10)) n = analyze(slst, cw); + if (n == 0) return 0; + // convert the result to ana1ana2 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->&->& +- if (!r) return 0; +- strcpy(r, ""); ++ std::string r; ++ r.append(""); + for (int i = 0; i < n; i++) { +- int l = strlen(r); +- strcpy(r + l, ""); +- strcpy(r + l + 3, (*slst)[i]); +- mystrrep(r + l + 3, "\t", " "); +- mystrrep(r + l + 3, "<", "<"); +- mystrrep(r + l + 3, "&", "&"); +- strcat(r, ""); ++ r.append(""); ++ ++ std::string entry((*slst)[i]); + free((*slst)[i]); ++ myrep(entry, "\t", " "); ++ myrep(entry, "<", "<"); ++ myrep(entry, "&", "&"); ++ r.append(entry); ++ ++ r.append(""); + } +- strcat(r, ""); +- (*slst)[0] = r; ++ r.append(""); ++ (*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); diff --git a/hunspell.spec b/hunspell.spec index c84ff0c..4c1a7fc 100644 --- a/hunspell.spec +++ b/hunspell.spec @@ -3,7 +3,7 @@ Name: hunspell Summary: A spell checker and morphological analyzer library Version: 1.3.2 -Release: 9%{?dist} +Release: 10%{?dist} Source: http://downloads.sourceforge.net/%{name}/hunspell-%{version}.tar.gz Group: System Environment/Libraries URL: http://hunspell.sourceforge.net/ @@ -18,6 +18,7 @@ BuildRequires: words %endif Requires: hunspell-en-US Patch0: hunspell.rhbz759647.patch +Patch1: hunspell.rhbz918938.patch %description Hunspell is a spell checker and morphological analyzer library and program @@ -36,6 +37,7 @@ Includes and definitions for developing with hunspell %prep %setup -q %patch0 -p0 -b .rhbz759647 +%patch2 -p0 -b .rhbz918938 %build configureflags="--disable-rpath --disable-static --with-ui --with-readline" @@ -125,6 +127,9 @@ rm -rf $RPM_BUILD_ROOT %{_mandir}/man3/hunspell.3.gz %changelog +* Wed Mar 13 2013 Caolán McNamara - 1.3.2-10 +- Resolves: rhbz#918938 crash in danish thesaurus/spell interaction + * Thu Feb 14 2013 Fedora Release Engineering - 1.3.2-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild