From a23e4d5a3b4043adbcbce2545cb62e5ea98654c6 Mon Sep 17 00:00:00 2001 From: Nikola Forró Date: Apr 04 2018 13:44:23 +0000 Subject: - resolves: #1562364 do not call back() on an empty vector --- diff --git a/aspell-0.60.6.1-fix-back-on-empty-vector.patch b/aspell-0.60.6.1-fix-back-on-empty-vector.patch new file mode 100644 index 0000000..f41db9b --- /dev/null +++ b/aspell-0.60.6.1-fix-back-on-empty-vector.patch @@ -0,0 +1,38 @@ +From c6755a399e8a31cbee5129dde5124f9c54a47ab6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nikola=20Forr=C3=B3?= +Date: Wed, 4 Apr 2018 14:58:03 +0200 +Subject: [PATCH] Do not call back() on an empty vector +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Calling std::vector::back() on an empty container is undefined. +Avoid doing that, simply return pointer to the beginning in case +the vector is empty. + +Signed-off-by: Nikola Forró +--- + common/vector.hpp | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/common/vector.hpp b/common/vector.hpp +index 782e4b0..cb344bd 100644 +--- a/common/vector.hpp ++++ b/common/vector.hpp +@@ -36,13 +36,13 @@ namespace acommon + } + T * data() {return &*this->begin();} + T * data(int pos) {return &*this->begin() + pos;} +- T * data_end() {return &this->back()+1;} ++ T * data_end() {return this->empty() ? &*this->begin() : &this->back()+1;} + + T * pbegin() {return &*this->begin();} +- T * pend() {return &this->back()+1;} ++ T * pend() {return this->empty() ? &*this->begin() : &this->back()+1;} + + const T * pbegin() const {return &*this->begin();} +- const T * pend() const {return &this->back()+1;} ++ const T * pend() const {return this->empty() ? &*this->begin() : &this->back()+1;} + + template + U * datap() { diff --git a/aspell.spec b/aspell.spec index 26d52d5..207518f 100644 --- a/aspell.spec +++ b/aspell.spec @@ -1,7 +1,7 @@ Summary: Spell checker Name: aspell Version: 0.60.6.1 -Release: 20%{?dist} +Release: 21%{?dist} Epoch: 12 # LGPLv2+ .. common/gettext.h # LGPLv2 .. modules/speller/default/phonet.hpp, @@ -26,6 +26,8 @@ Patch5: aspell-0.60.6.1-dump-personal-abort.patch Patch6: aspell-0.60.6.1-aarch64.patch # resolves: #1423239 Patch7: aspell-0.60.6.1-gcc7-fixes.patch +# resolves: #1562364 +Patch8: aspell-0.60.6.1-fix-back-on-empty-vector.patch BuildRequires: gcc-c++ BuildRequires: chrpath, gettext, ncurses-devel, pkgconfig, perl-interpreter @@ -64,6 +66,7 @@ and header files needed for Aspell development. %patch5 -p1 -b .dump-personal %patch6 -p1 -b .aarch64 %patch7 -p1 -b .gcc7-fixes +%patch8 -p1 -b .back-empty-vector iconv -f iso-8859-2 -t utf-8 < manual/aspell.info > manual/aspell.info.aux mv manual/aspell.info.aux manual/aspell.info @@ -156,6 +159,10 @@ fi %{_mandir}/man1/pspell-config.1* %changelog +* Wed Apr 04 2018 Nikola Forró - 12:0.60.6.1-21 +- resolves: #1562364 + do not call back() on an empty vector + * Tue Feb 20 2018 Nikola Forró - 12:0.60.6.1-20 - add missing gcc-c++ build dependency