This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit ef788779f9ce90d753947746fe9c15d10533418c
Author: Carsten Haitzler <[email protected]>
AuthorDate: Sun Mar 5 09:33:54 2023 +0000

    evrything - fix handling of broken strings without looping forever
    
    this should fix #20
    
    https://git.enlightenment.org/enlightenment/enlightenment/issues/20
    @fix
---
 src/modules/everything/evry_util.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/modules/everything/evry_util.c b/src/modules/everything/evry_util.c
index 7817c7ff6..128e9819a 100644
--- a/src/modules/everything/evry_util.c
+++ b/src/modules/everything/evry_util.c
@@ -60,7 +60,7 @@ _evry_utf8_next(const char *buf, int *iindex)
 int
 evry_fuzzy_match(const char *str, const char *match)
 {
-   const char *p, *m, *next;
+   const char *p, *pp, *m, *pm, *next;
    int sum = 0;
 
    unsigned int last = 0;
@@ -104,10 +104,15 @@ evry_fuzzy_match(const char *str, const char *match)
    next = str;
    m = match;
 
+   pm = NULL;
    while ((m_cnt < m_num) && (*next != 0))
      {
         int ii;
 
+        /* check for a broken encoded string - not advancing */
+        if (pm == m) goto broken_string;
+        pm = m;
+
         /* reset match */
         if (m_cnt == 0) m = match;
 
@@ -120,9 +125,13 @@ evry_fuzzy_match(const char *str, const char *match)
         first = 0;
         /* m_len = 0; */
 
+        pp = NULL;
         /* match current word of string against current match */
         for (p = next; *next != 0; p++)
           {
+             /* check for a broken encoded string - not advancing */
+             if (pp == p) goto broken_string;
+             pp = p;
              /* new word of string begins */
              if ((*p == 0) || isspace(*p) || (ip && ispunct(*p)))
                {
@@ -241,6 +250,7 @@ evry_fuzzy_match(const char *str, const char *match)
                }
           }
      }
+   broken_string:
 
    for (m_cnt = 0; m_cnt < m_num; m_cnt++)
      {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to