Fix a few places that were non-multibyte-safe in tsearch configuration file
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Jun 2008 16:52:31 +0000 (16:52 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Jun 2008 16:52:31 +0000 (16:52 +0000)
parsing.  Per bug #4253 from Giorgio Valoti.

src/backend/tsearch/spell.c
src/backend/tsearch/ts_utils.c

index daa3abf7b29af07849ad0715fea5a7e890c768f4..583296078c01b848eaf191cf99450d64b6a17573 100644 (file)
@@ -509,7 +509,7 @@ static void
 addFlagValue(IspellDict *Conf, char *s, uint32 val)
 {
        while (*s && t_isspace(s))
-               s++;
+               s += pg_mblen(s);
 
        if (!*s)
                ereport(ERROR,
@@ -595,7 +595,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
                        char       *s = recoded + strlen("FLAG");
 
                        while (*s && t_isspace(s))
-                               s++;
+                               s += pg_mblen(s);
 
                        if (*s && STRNCMP(s, "default") != 0)
                                ereport(ERROR,
@@ -729,9 +729,9 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
                                s = recoded + (s - pstr);               /* we need non-lowercased
                                                                                                 * string */
                                while (*s && !t_isspace(s))
-                                       s++;
+                                       s += pg_mblen(s);
                                while (*s && t_isspace(s))
-                                       s++;
+                                       s += pg_mblen(s);
 
                                if (*s && pg_mblen(s) == 1)
                                {
@@ -762,7 +762,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
                        flagflags = 0;
 
                        while (*s && t_isspace(s))
-                               s++;
+                               s += pg_mblen(s);
                        oldformat = true;
 
                        /* allow only single-encoded flags */
index 4cc53b2483fff4c7f57c5386c6ca487cf8508b12..2c3d9cb3f21ea3b2ea53d86b7d2c7626a7cf8545 100644 (file)
@@ -97,7 +97,7 @@ readstoplist(const char *fname, StopList *s, char *(*wordop) (const char *))
 
                        /* Trim trailing space */
                        while (*pbuf && !t_isspace(pbuf))
-                               pbuf++;
+                               pbuf += pg_mblen(pbuf);
                        *pbuf = '\0';
 
                        /* Skip empty lines */