aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2016-04-08 21:26:25 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2016-04-08 21:26:25 +0300
commit94cda4f1065bcd21bdce664dc03eaa31faba0442 (patch)
tree793b6aa1f05feccc5884eef74b01c7754fb155f4 /src
parentd2189a8026dbfa7542c96e4a63ef09b02e625748 (diff)
downloadpostgresql-94cda4f1065bcd21bdce664dc03eaa31faba0442.tar.gz
postgresql-94cda4f1065bcd21bdce664dc03eaa31faba0442.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 b2da46c5872..edaf0424814 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))