aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2016-04-08 21:25:14 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2016-04-08 21:25:14 +0300
commitcb0c8cbf316f9362c11d7a8356e6f459258ae78e (patch)
treed2dfcb3de6bbc49339cf032209c6dbbded71f66d /src
parent690c543550b0d2852060c18d270cdb534d339d9a (diff)
downloadpostgresql-cb0c8cbf316f9362c11d7a8356e6f459258ae78e.tar.gz
postgresql-cb0c8cbf316f9362c11d7a8356e6f459258ae78e.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 2faa15ebd4c..ca352af3315 100644
--- a/src/backend/tsearch/wparser_def.c
+++ b/src/backend/tsearch/wparser_def.c
@@ -2465,6 +2465,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))