Re: Text search segmentation fault - Mailing list pgsql-general

From Teodor Sigaev
Subject Re: Text search segmentation fault
Date
Msg-id 4981CAA1.1090205@sigaev.ru
Whole thread Raw
In response to Text search segmentation fault  (Tommy Gildseth <tommy.gildseth@usit.uio.no>)
Responses Re: Text search segmentation fault  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Re: Text search segmentation fault  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Text search segmentation fault  (Gregory Stark <stark@enterprisedb.com>)
Re: Text search segmentation fault  (Tommy Gildseth <tommy.gildseth@usit.uio.no>)
List pgsql-general
I reproduced the bug with a help of Grzegorz's point for 64-bit box. So, patch
is attached and I'm going to commit it

--
Teodor Sigaev                                   E-mail: teodor@sigaev.ru
                                                    WWW: http://www.sigaev.ru/
*** src/backend/tsearch/spell.c.orig    2009-01-29 18:18:03.000000000 +0300
--- src/backend/tsearch/spell.c    2009-01-29 18:20:09.000000000 +0300
***************
*** 521,527 ****
                  (errcode(ERRCODE_CONFIG_FILE_ERROR),
                   errmsg("multibyte flag character is not allowed")));

!     Conf->flagval[(unsigned int) *s] = (unsigned char) val;
      Conf->usecompound = true;
  }

--- 521,527 ----
                  (errcode(ERRCODE_CONFIG_FILE_ERROR),
                   errmsg("multibyte flag character is not allowed")));

!     Conf->flagval[*(unsigned char*) s] = (unsigned char) val;
      Conf->usecompound = true;
  }

***************
*** 654,660 ****
                  ptr = repl + (ptr - prepl) + 1;
                  while (*ptr)
                  {
!                     aflg |= Conf->flagval[(unsigned int) *ptr];
                      ptr++;
                  }
              }
--- 654,660 ----
                  ptr = repl + (ptr - prepl) + 1;
                  while (*ptr)
                  {
!                     aflg |= Conf->flagval[*(unsigned char*) ptr];
                      ptr++;
                  }
              }
***************
*** 735,741 ****

                  if (*s && pg_mblen(s) == 1)
                  {
!                     Conf->flagval[(unsigned int) *s] = FF_COMPOUNDFLAG;
                      Conf->usecompound = true;
                  }
                  oldformat = true;
--- 735,741 ----

                  if (*s && pg_mblen(s) == 1)
                  {
!                     Conf->flagval[*(unsigned char*) s] = FF_COMPOUNDFLAG;
                      Conf->usecompound = true;
                  }
                  oldformat = true;
***************
*** 791,797 ****
                          (errcode(ERRCODE_CONFIG_FILE_ERROR),
                           errmsg("multibyte flag character is not allowed")));

!             flag = (unsigned char) *s;
              goto nextline;
          }
          if (STRNCMP(recoded, "COMPOUNDFLAG") == 0 || STRNCMP(recoded, "COMPOUNDMIN") == 0 ||
--- 791,797 ----
                          (errcode(ERRCODE_CONFIG_FILE_ERROR),
                           errmsg("multibyte flag character is not allowed")));

!             flag = *(unsigned char*) s;
              goto nextline;
          }
          if (STRNCMP(recoded, "COMPOUNDFLAG") == 0 || STRNCMP(recoded, "COMPOUNDMIN") == 0 ||
***************
*** 851,857 ****

      while (str && *str)
      {
!         flag |= Conf->flagval[(unsigned int) *str];
          str++;
      }

--- 851,857 ----

      while (str && *str)
      {
!         flag |= Conf->flagval[*(unsigned char*) str];
          str++;
      }


pgsql-general by date:

Previous
From: Mark Styles
Date:
Subject: Changing owner of pg_toast tables
Next
From: Teodor Sigaev
Date:
Subject: Re: Text search segmentation fault