Resolves: rhbz#650503 Arabic spellchecking crash

This commit is contained in:
Caolán McNamara 2010-11-08 11:47:57 +00:00
parent a744e2346f
commit a5e8ae46a5
2 changed files with 157 additions and 1 deletions

150
backport.rhbz650503.patch Normal file
View File

@ -0,0 +1,150 @@
Index: src/hunspell/affentry.cxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/affentry.cxx,v
retrieving revision 1.5
diff -u -r1.5 affentry.cxx
--- src/hunspell/affentry.cxx 27 Apr 2010 15:01:04 -0000 1.5
+++ src/hunspell/affentry.cxx 8 Nov 2010 11:36:57 -0000
@@ -106,7 +106,7 @@
pos = NULL;
p = nextchar(p);
// skip the next character
- if (!ingroup) for (st++; (opts & aeUTF8) && (*st & 0xc0) == 0x80; st++);
+ if (!ingroup && *st) for (st++; (opts & aeUTF8) && (*st & 0xc0) == 0x80; st++);
if (*st == '\0' && p) return 0; // word <= condition
break;
}
Index: src/hunspell/hunspell.cxx
===================================================================
RCS file: /cvsroot/hunspell/hunspell/src/hunspell/hunspell.cxx,v
retrieving revision 1.23
diff -u -r1.23 hunspell.cxx
--- src/hunspell/hunspell.cxx 3 Nov 2010 16:08:04 -0000 1.23
+++ src/hunspell/hunspell.cxx 8 Nov 2010 11:36:58 -0000
@@ -570,6 +570,11 @@
word = w2;
} else word = w;
+ len = strlen(word);
+
+ if (!len)
+ return NULL;
+
// word reversing wrapper for complex prefixes
if (complexprefixes) {
if (word != w2) {
@@ -607,7 +612,6 @@
// check with affixes
if (!he && pAMgr) {
// try stripping off affixes */
- len = strlen(word);
he = pAMgr->affix_check(word, len, 0);
// check compound restriction and onlyupcase
Index: tests/Makefile.am
===================================================================
RCS file: /cvsroot/hunspell/hunspell/tests/Makefile.am,v
retrieving revision 1.4
diff -u -r1.4 Makefile.am
--- tests/Makefile.am 7 Oct 2010 21:05:49 -0000 1.4
+++ tests/Makefile.am 8 Nov 2010 11:36:58 -0000
@@ -101,7 +101,8 @@
fullstrip.test \
iconv.test \
oconv.test \
-korean.test
+korean.test \
+arabic.test
# infixes.test
distclean-local:
@@ -593,7 +594,10 @@
korean.dic \
korean.good \
korean.wrong \
-korean.test
+korean.test \
+arabic.aff \
+arabic.dic \
+arabic.bad
# infixes.aff
# infixes.dic
# infixes.good
Index: tests/Makefile.in
===================================================================
RCS file: /cvsroot/hunspell/hunspell/tests/Makefile.in,v
retrieving revision 1.8
diff -u -r1.8 Makefile.in
--- tests/Makefile.in 7 Oct 2010 21:05:49 -0000 1.8
+++ tests/Makefile.in 8 Nov 2010 11:36:58 -0000
@@ -283,6 +283,7 @@
SUBDIRS = suggestiontest
XFAIL_TESTS = @XFAILED@
TESTS = \
+arabic.test \
affixes.test \
condition.test \
condition_utf.test \
@@ -379,7 +380,8 @@
fullstrip.test \
iconv.test \
oconv.test \
-korean.test
+korean.test \
+arabic.test
EXTRA_DIST = \
test.sh \
@@ -867,7 +869,10 @@
korean.dic \
korean.good \
korean.wrong \
-korean.test
+korean.test \
+arabic.aff \
+arabic.dic \
+arabic.bad
all: all-recursive
Index: arabic.test
===================================================================
RCS file: arabic.test
diff -N arabic.test
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/arabic.test 8 Nov 2010 11:41:33 -0000
@@ -0,0 +1,4 @@
+#!/bin/sh
+DIR="`dirname $0`"
+NAME="`basename $0 .test`"
+$DIR/test.sh $NAME -i UTF-8
Index: arabic.bad
===================================================================
RCS file: arabic.bad
diff -N arabic.bad
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/arabic.bad 8 Nov 2010 11:41:59 -0000
@@ -0,0 +1 @@
Index: arabic.dic
===================================================================
RCS file: arabic.dic
diff -N arabic.dic
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/arabic.dic 8 Nov 2010 11:42:15 -0000
@@ -0,0 +1,2 @@
+1
Index: arabic.aff
===================================================================
RCS file: arabic.aff
diff -N arabic.aff
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/arabic.aff 8 Nov 2010 11:42:27 -0000
@@ -0,0 +1,6 @@
+SET UTF-8
+TRY أ
+IGNORE ٌٍَُِّْ
+
+PFX Aa Y 1
+PFX Aa 0 0/X0 أ[^ي]

View File

@ -3,7 +3,7 @@
Name: hunspell
Summary: A spell checker and morphological analyzer library
Version: 1.2.12
Release: 2%{?dist}
Release: 3%{?dist}
Source: http://downloads.sourceforge.net/%{name}/hunspell-%{version}.tar.gz
Group: System Environment/Libraries
URL: http://hunspell.sourceforge.net/
@ -17,6 +17,7 @@ BuildRequires: valgrind
BuildRequires: words
%endif
Patch1: backport.warnings.patch
Patch2: backport.rhbz650503.patch
%description
Hunspell is a spell checker and morphological analyzer library and program
@ -35,6 +36,8 @@ Includes and definitions for developing with hunspell
%prep
%setup -q
%patch1 -p0 -b .backport.warnings
%patch2 -p0 -b .backport.rhbz650503
chmod u+x tests/arabic.test
%build
configureflags="--disable-rpath --disable-static --with-ui --with-readline"
@ -123,6 +126,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man3/hunspell.3.gz
%changelog
* Mon Nov 08 2010 Caolán McNamara <caolanm@redhat.com> - 1.2.12-3
- Resolves: rhbz#650503 Arabic spellchecking crash
* Fri Nov 05 2010 Caolán McNamara <caolanm@redhat.com> - 1.2.12-2
- Resolves: rhbz#648740 thousands of trailing empty rules spew