Prevent recursion during parse of email-like string with multiple '@'.
authorTeodor Sigaev <teodor@sigaev.ru>
Tue, 10 Mar 2009 17:32:14 +0000 (17:32 +0000)
committerTeodor Sigaev <teodor@sigaev.ru>
Tue, 10 Mar 2009 17:32:14 +0000 (17:32 +0000)
Patch by Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>

src/backend/tsearch/wparser_def.c

index ad98fa57225c017a9ef21f645758648550474123..74a8a61f348bde8a5151454f14107ad4cddc2196 100644 (file)
@@ -620,6 +620,8 @@ p_ishost(TParser *prs)
        TParser    *tmpprs = TParserInit(prs->str + prs->state->posbyte, prs->lenstr - prs->state->posbyte);
        int                     res = 0;
 
+       tmpprs->wanthost = true;
+
        if (TParserGet(tmpprs) && tmpprs->type == HOST)
        {
                prs->state->posbyte += tmpprs->lenbytetoken;
@@ -1070,6 +1072,7 @@ static const TParserStateActionItem actionTPS_InHost[] = {
 };
 
 static const TParserStateActionItem actionTPS_InEmail[] = {
+       {p_isstophost, 0, A_POP, TPS_Null, 0, NULL},
        {p_ishost, 0, A_BINGO | A_CLRALL, TPS_Base, EMAIL, NULL},
        {NULL, 0, A_POP, TPS_Null, 0, NULL}
 };