Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Caolán McNamara
e8d9426afb Resolves: rhbz#1429258 survive .dics which appear to be empty 2017-03-06 11:04:38 +00:00
2 changed files with 41 additions and 1 deletions

View file

@ -0,0 +1,35 @@
From d1c7de132e45a57dbc45818935bd29792fd4772b Mon Sep 17 00:00:00 2001
From: Dimitrij Mijoski <dmjpp@hotmail.com>
Date: Wed, 16 Nov 2016 02:29:35 +0100
Subject: [PATCH] Fix possible division with zero in hashmgr, issue #154 and
#245
---
src/hunspell/hashmgr.cxx | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/src/hunspell/hashmgr.cxx b/src/hunspell/hashmgr.cxx
index 072bc1a..19d33c8 100644
--- a/src/hunspell/hashmgr.cxx
+++ b/src/hunspell/hashmgr.cxx
@@ -104,11 +104,13 @@ HashMgr::HashMgr(const char* tpath, const char* apath, const char* key)
if (ec) {
/* error condition - what should we do here */
HUNSPELL_WARNING(stderr, "Hash Manager Error : %d\n", ec);
- if (tableptr) {
- free(tableptr);
- tableptr = NULL;
+ free(tableptr);
+ //keep tablesize to 1 to fix possible division with zero
+ tablesize = 1;
+ tableptr = (struct hentry**)calloc(tablesize, sizeof(struct hentry*));
+ if (!tableptr) {
+ tablesize = 0;
}
- tablesize = 0;
}
}
--
2.9.3

View file

@ -3,7 +3,7 @@
Name: hunspell
Summary: A spell checker and morphological analyzer library
Version: 1.4.1
Release: 1%{?dist}
Release: 2%{?dist}
Source: https://github.com/hunspell/hunspell/archive/v%{version}.tar.gz
Group: System Environment/Libraries
URL: https://github.com/hunspell/hunspell
@ -18,6 +18,7 @@ BuildRequires: valgrind
BuildRequires: words
%endif
Requires: hunspell-en-US
Patch1: 0001-Fix-possible-division-with-zero-in-hashmgr-issue-154.patch
%description
Hunspell is a spell checker and morphological analyzer library and program
@ -35,6 +36,7 @@ Includes and definitions for developing with hunspell
%prep
%setup -q
%patch1 -p1 -b .rhbz1429258
%build
configureflags="--disable-rpath --disable-static --with-ui --with-readline"
@ -122,6 +124,9 @@ rm -rf $RPM_BUILD_ROOT
%{_mandir}/man5/hunspell.5.gz
%changelog
* Mon Mar 06 2017 Caolán McNamara <caolanm@redhat.com> - 1.4.1-2
- Resolves: rhbz#1429258 survive .dics which appear to be empty
* Tue May 03 2016 Caolán McNamara <caolanm@redhat.com> - 1.4.1-1
- latest version