Skip to content

Commit 30dc388

Browse files
committed
Fix a few places that were non-multibyte-safe in tsearch configuration file
parsing. Per bug #4253 from Giorgio Valoti.
1 parent e3ae278 commit 30dc388

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/backend/tsearch/spell.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.12 2008/06/18 20:55:42 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/spell.c,v 1.13 2008/06/19 16:52:24 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -509,7 +509,7 @@ static void
509509
addFlagValue(IspellDict *Conf, char *s, uint32 val)
510510
{
511511
while (*s && t_isspace(s))
512-
s++;
512+
s += pg_mblen(s);
513513

514514
if (!*s)
515515
ereport(ERROR,
@@ -595,7 +595,7 @@ NIImportOOAffixes(IspellDict *Conf, const char *filename)
595595
char *s = recoded + strlen("FLAG");
596596

597597
while (*s && t_isspace(s))
598-
s++;
598+
s += pg_mblen(s);
599599

600600
if (*s && STRNCMP(s, "default") != 0)
601601
ereport(ERROR,
@@ -729,9 +729,9 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
729729
s = recoded + (s - pstr); /* we need non-lowercased
730730
* string */
731731
while (*s && !t_isspace(s))
732-
s++;
732+
s += pg_mblen(s);
733733
while (*s && t_isspace(s))
734-
s++;
734+
s += pg_mblen(s);
735735

736736
if (*s && pg_mblen(s) == 1)
737737
{
@@ -762,7 +762,7 @@ NIImportAffixes(IspellDict *Conf, const char *filename)
762762
flagflags = 0;
763763

764764
while (*s && t_isspace(s))
765-
s++;
765+
s += pg_mblen(s);
766766
oldformat = true;
767767

768768
/* allow only single-encoded flags */

src/backend/tsearch/ts_utils.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/tsearch/ts_utils.c,v 1.11 2008/06/18 20:55:42 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/tsearch/ts_utils.c,v 1.12 2008/06/19 16:52:24 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -97,7 +97,7 @@ readstoplist(const char *fname, StopList *s, char *(*wordop) (const char *))
9797

9898
/* Trim trailing space */
9999
while (*pbuf && !t_isspace(pbuf))
100-
pbuf++;
100+
pbuf += pg_mblen(pbuf);
101101
*pbuf = '\0';
102102

103103
/* Skip empty lines */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy