summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2016-04-08 21:25:59 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2016-04-08 21:25:59 +0300
commit9d3fb209a07656fdee6f190013ecfcd1c590bedb (patch)
treee499c258096147c59c35dd2f1ba1970e7739f22a
parentca5d6edbfe6bb060e815ef0195ed67c05842bede (diff)
Fix possible use of uninitialised value in ts_headline()
Found during investigation of failure of skink buildfarm member and its valgrind report. Backpatch to all supported branches
-rw-r--r--src/backend/tsearch/wparser_def.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/backend/tsearch/wparser_def.c b/src/backend/tsearch/wparser_def.c
index cfd07fd4bf3..6f117bdf648 100644
--- a/src/backend/tsearch/wparser_def.c
+++ b/src/backend/tsearch/wparser_def.c
@@ -2439,6 +2439,8 @@ mark_hl_words(HeadlineParsedText *prs, TSQuery query, int highlight,
}
else
{ /* shorter cover :((( */
+ if (i > q)
+ i = q;
for (; curlen > min_words; i--)
{
if (!NONWORDTOKEN(prs->words[i].type))