aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/utils/adt/tsvector.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/utils/adt/tsvector.c b/src/backend/utils/adt/tsvector.c
index 0e66f362c30..dff0bfe41fc 100644
--- a/src/backend/utils/adt/tsvector.c
+++ b/src/backend/utils/adt/tsvector.c
@@ -498,7 +498,7 @@ tsvectorrecv(PG_FUNCTION_ARGS)
* But make sure the buffer is large enough first.
*/
while (hdrlen + SHORTALIGN(datalen + lex_len) +
- (npos + 1) * sizeof(WordEntryPos) >= len)
+ sizeof(uint16) + npos * sizeof(WordEntryPos) >= len)
{
len *= 2;
vec = (TSVector) repalloc(vec, len);
@@ -544,7 +544,7 @@ tsvectorrecv(PG_FUNCTION_ARGS)
elog(ERROR, "position information is misordered");
}
- datalen += (npos + 1) * sizeof(WordEntry);
+ datalen += sizeof(uint16) + npos * sizeof(WordEntryPos);
}
}