download.lst                                                                   
   |    4 
 
external/hunspell/0001-check-len-in-cpdpat_check-like-r1-blen-is-checked-63.patch
 |   27 +++++
 external/hunspell/0001-improve-630-test-case-from-0m1.836s-0m1.223s-785.patch  
   |   52 ++++++++++
 external/hunspell/0001-improve-630-test-case-from-0m2.427s-0m1.836s-781.patch  
   |   40 +++++++
 external/hunspell/0001-invalid-read-memory-access-624.patch                    
   |   25 ----
 external/hunspell/UnpackedTarball_hunspell.mk                                  
   |    4 
 6 files changed, 124 insertions(+), 28 deletions(-)

New commits:
commit 6594a545a45e83120a9730792d5ad471b01dd60e
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Tue Aug 23 15:25:54 2022 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Sun Aug 28 13:50:35 2022 +0200

    backport some upstream hunspell commits
    
    Change-Id: I0c2b94a27af8c25c69579b367b944a4f77036487
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138735
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git 
a/external/hunspell/0001-check-len-in-cpdpat_check-like-r1-blen-is-checked-63.patch
 
b/external/hunspell/0001-check-len-in-cpdpat_check-like-r1-blen-is-checked-63.patch
new file mode 100644
index 000000000000..58b68d0dda43
--- /dev/null
+++ 
b/external/hunspell/0001-check-len-in-cpdpat_check-like-r1-blen-is-checked-63.patch
@@ -0,0 +1,27 @@
+From 56ad6310c95695d25f936d3f89f6ee3d787df274 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caol...@redhat.com>
+Date: Mon, 22 Aug 2022 21:21:36 +0100
+Subject: [PATCH] check 'len' in cpdpat_check like 'r1->blen' is checked (#633)
+ (#780)
+
+we should check len against pos like we do r1->blen in the line above
+---
+ src/hunspell/affixmgr.cxx | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/hunspell/affixmgr.cxx b/src/hunspell/affixmgr.cxx
+index 7ea1ea5..c2432c0 100644
+--- a/src/hunspell/affixmgr.cxx
++++ b/src/hunspell/affixmgr.cxx
+@@ -1330,7 +1330,7 @@ int AffixMgr::cpdpat_check(const char* word,
+          ((checkcpdtable[i].pattern[0] == '0' && r1->blen <= pos &&
+            strncmp(word + pos - r1->blen, r1->word, r1->blen) == 0) ||
+           (checkcpdtable[i].pattern[0] != '0' &&
+-           ((len = checkcpdtable[i].pattern.size()) != 0) &&
++           ((len = checkcpdtable[i].pattern.size()) != 0) && len <= pos &&
+            strncmp(word + pos - len, checkcpdtable[i].pattern.c_str(), len) 
== 0)))) {
+       return 1;
+     }
+-- 
+2.37.2
+
diff --git 
a/external/hunspell/0001-improve-630-test-case-from-0m1.836s-0m1.223s-785.patch 
b/external/hunspell/0001-improve-630-test-case-from-0m1.836s-0m1.223s-785.patch
new file mode 100644
index 000000000000..a42d38f5153a
--- /dev/null
+++ 
b/external/hunspell/0001-improve-630-test-case-from-0m1.836s-0m1.223s-785.patch
@@ -0,0 +1,52 @@
+From 75ebf084f941c0fe72904b6167079d9190f885e5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caol...@redhat.com>
+Date: Tue, 23 Aug 2022 11:44:36 +0100
+Subject: [PATCH] improve #630 test case from 0m1.836s -> 0m1.223s (#785)
+
+---
+ src/hunspell/csutil.cxx | 16 ++++++++++------
+ 1 file changed, 10 insertions(+), 6 deletions(-)
+
+diff --git a/src/hunspell/csutil.cxx b/src/hunspell/csutil.cxx
+index e9cce47..5caa771 100644
+--- a/src/hunspell/csutil.cxx
++++ b/src/hunspell/csutil.cxx
+@@ -171,8 +171,10 @@ std::string& u16_u8(std::string& dest, const 
std::vector<w_char>& src) {
+ }
+ 
+ int u8_u16(std::vector<w_char>& dest, const std::string& src) {
+-  dest.clear();
+-  dest.reserve(src.size());
++  // faster to oversize initially, assign to elements and resize to what's 
used
++  // than to reserve and push_back
++  dest.resize(src.size());
++  std::vector<w_char>::iterator u16 = dest.begin();
+   std::string::const_iterator u8 = src.begin();
+   std::string::const_iterator u8_max = src.end();
+ 
+@@ -254,16 +256,18 @@ int u8_u16(std::vector<w_char>& dest, const std::string& 
src) {
+                          src.c_str());
+         u2.h = 0xff;
+         u2.l = 0xfd;
+-        dest.push_back(u2);
++        *u16++ = u2;
++        dest.resize(u16 - dest.begin());
+         return -1;
+       }
+     }
+-    dest.push_back(u2);
++    *u16++ = u2;
+     ++u8;
+   }
+ 
+-  dest.shrink_to_fit();
+-  return dest.size();
++  int size = u16 - dest.begin();
++  dest.resize(size);
++  return size;
+ }
+ 
+ namespace {
+-- 
+2.37.2
+
diff --git 
a/external/hunspell/0001-improve-630-test-case-from-0m2.427s-0m1.836s-781.patch 
b/external/hunspell/0001-improve-630-test-case-from-0m2.427s-0m1.836s-781.patch
new file mode 100644
index 000000000000..c3de49178ada
--- /dev/null
+++ 
b/external/hunspell/0001-improve-630-test-case-from-0m2.427s-0m1.836s-781.patch
@@ -0,0 +1,40 @@
+From 211e1e6f36756579b86fa12891af3e5843cd8907 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caol...@redhat.com>
+Date: Tue, 23 Aug 2022 10:18:31 +0100
+Subject: [PATCH] improve #630 test case from 0m2.427s -> 0m1.836s (#781)
+
+---
+ src/hunspell/csutil.cxx | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/hunspell/csutil.cxx b/src/hunspell/csutil.cxx
+index fbaa768..e9cce47 100644
+--- a/src/hunspell/csutil.cxx
++++ b/src/hunspell/csutil.cxx
+@@ -134,6 +134,7 @@ void myopen(std::ifstream& stream, const char* path, 
std::ios_base::openmode mod
+ 
+ std::string& u16_u8(std::string& dest, const std::vector<w_char>& src) {
+   dest.clear();
++  dest.reserve(src.size());
+   std::vector<w_char>::const_iterator u2 = src.begin();
+   std::vector<w_char>::const_iterator u2_max = src.end();
+   while (u2 < u2_max) {
+@@ -171,6 +172,7 @@ std::string& u16_u8(std::string& dest, const 
std::vector<w_char>& src) {
+ 
+ int u8_u16(std::vector<w_char>& dest, const std::string& src) {
+   dest.clear();
++  dest.reserve(src.size());
+   std::string::const_iterator u8 = src.begin();
+   std::string::const_iterator u8_max = src.end();
+ 
+@@ -260,6 +262,7 @@ int u8_u16(std::vector<w_char>& dest, const std::string& 
src) {
+     ++u8;
+   }
+ 
++  dest.shrink_to_fit();
+   return dest.size();
+ }
+ 
+-- 
+2.37.2
+
diff --git a/external/hunspell/UnpackedTarball_hunspell.mk 
b/external/hunspell/UnpackedTarball_hunspell.mk
index 37a2d196fbf5..33614a39292d 100644
--- a/external/hunspell/UnpackedTarball_hunspell.mk
+++ b/external/hunspell/UnpackedTarball_hunspell.mk
@@ -22,6 +22,9 @@ endif
 $(eval $(call gb_UnpackedTarball_set_patchlevel,hunspell,1))
 
 $(eval $(call gb_UnpackedTarball_add_patches,hunspell, \
+       
external/hunspell/0001-check-len-in-cpdpat_check-like-r1-blen-is-checked-63.patch
 \
+       
external/hunspell/0001-improve-630-test-case-from-0m2.427s-0m1.836s-781.patch \
+       
external/hunspell/0001-improve-630-test-case-from-0m1.836s-0m1.223s-785.patch \
 ))
 
 # vim: set noet sw=4 ts=4:
commit d033bb8058f922b84b9c51190132035fa0489a45
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Mon Aug 22 15:05:40 2022 +0100
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Sun Aug 28 13:50:16 2022 +0200

    upgrade to hunspell 1.7.1
    
    Change-Id: Ifff2f17d17ab2764f3703b008fcb096ff08c9315
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138690
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/download.lst b/download.lst
index 4ec74570bd2c..505bb3027d5b 100644
--- a/download.lst
+++ b/download.lst
@@ -130,8 +130,8 @@ export HARFBUZZ_SHA256SUM := 
d58461395ce28b9dc03903254374dd70c38c8c28c5046db123c
 export HARFBUZZ_TARBALL := harfbuzz-2.8.2.tar.xz
 export HSQLDB_SHA256SUM := 
d30b13f4ba2e3b6a2d4f020c0dee0a9fb9fc6fbcc2d561f36b78da4bf3802370
 export HSQLDB_TARBALL := 17410483b5b5f267aa18b7e00b65e6e0-hsqldb_1_8_0.zip
-export HUNSPELL_SHA256SUM := 
57be4e03ae9dd62c3471f667a0d81a14513e314d4d92081292b90435944ff951
-export HUNSPELL_TARBALL := hunspell-1.7.0.tar.gz
+export HUNSPELL_SHA256SUM := 
b2d9c5369c2cc7f321cb5983fda2dbf007dce3d9e17519746840a6f0c4bf7444
+export HUNSPELL_TARBALL := hunspell-1.7.1.tar.gz
 export HYPHEN_SHA256SUM := 
304636d4eccd81a14b6914d07b84c79ebb815288c76fe027b9ebff6ff24d5705
 export HYPHEN_TARBALL := 5ade6ae2a99bc1e9e57031ca88d36dad-hyphen-2.8.8.tar.gz
 export ICU_SHA256SUM := 
8d205428c17bf13bb535300669ed28b338a157b1c01ae66d31d0d3e2d47c3fd5
diff --git a/external/hunspell/0001-invalid-read-memory-access-624.patch 
b/external/hunspell/0001-invalid-read-memory-access-624.patch
deleted file mode 100644
index 66b55e7555bd..000000000000
--- a/external/hunspell/0001-invalid-read-memory-access-624.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From ac938e2ecb48ab4dd21298126c7921689d60571b Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caol...@redhat.com>
-Date: Tue, 12 Nov 2019 20:03:15 +0000
-Subject: [PATCH] invalid read memory access #624
-
----
- src/hunspell/suggestmgr.cxx | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/hunspell/suggestmgr.cxx b/src/hunspell/suggestmgr.cxx
-index dba084e..c23f165 100644
---- a/src/hunspell/suggestmgr.cxx
-+++ b/src/hunspell/suggestmgr.cxx
-@@ -2040,7 +2040,7 @@ int SuggestMgr::leftcommonsubstring(
-   int l2 = su2.size();
-   // decapitalize dictionary word
-   if (complexprefixes) {
--    if (su1[l1 - 1] == su2[l2 - 1])
-+    if (l1 && l2 && su1[l1 - 1] == su2[l2 - 1])
-       return 1;
-   } else {
-     unsigned short idx = su2.empty() ? 0 : (su2[0].h << 8) + su2[0].l;
--- 
-2.23.0
-
diff --git a/external/hunspell/UnpackedTarball_hunspell.mk 
b/external/hunspell/UnpackedTarball_hunspell.mk
index 1cd24e225868..37a2d196fbf5 100644
--- a/external/hunspell/UnpackedTarball_hunspell.mk
+++ b/external/hunspell/UnpackedTarball_hunspell.mk
@@ -22,7 +22,6 @@ endif
 $(eval $(call gb_UnpackedTarball_set_patchlevel,hunspell,1))
 
 $(eval $(call gb_UnpackedTarball_add_patches,hunspell, \
-       external/hunspell/0001-invalid-read-memory-access-624.patch \
 ))
 
 # vim: set noet sw=4 ts=4:

Reply via email to