From 0ae3a4dd52542000d93f75bd2b69b0cb5371c9dd Mon Sep 17 00:00:00 2001 From: Denis Erokhin Date: Tue, 19 Sep 2023 11:40:31 +0300 Subject: [PATCH v1 2/3] Replace magic "one" in tsvector binary receiving --- src/backend/utils/adt/tsvector.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/tsvector.c b/src/backend/utils/adt/tsvector.c index dfc12c4cc7..dff0bfe41f 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(WordEntryPos); + datalen += sizeof(uint16) + npos * sizeof(WordEntryPos); } } -- 2.39.2.windows.1