aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2016-04-08 21:25:47 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2016-04-08 21:25:47 +0300
commitb2a9e161ddb94daf3fa69e177b7e48ee944ec5a2 (patch)
treec13e66d9bc6c942c7ae7d319b7d56dd4e0ba0669 /src
parentf79a7fa90a7111974aa986ddf2b108f4525d89ab (diff)
downloadpostgresql-b2a9e161ddb94daf3fa69e177b7e48ee944ec5a2.tar.gz
postgresql-b2a9e161ddb94daf3fa69e177b7e48ee944ec5a2.zip
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
Diffstat (limited to 'src')
-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 d53f2e75c2e..cbf35e9e06e 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))