diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-03-07 13:13:33 +0200 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2014-03-07 13:29:33 +0200 |
commit | 4afc3f0faa3b1f86c23dabe716c3324962543fa6 (patch) | |
tree | 92ead5be3f5af483f5bb5ac48cda3f3bb888c554 /src/backend/utils/adt/tsvector.c | |
parent | 6f529325ad269fe5f76160779d1d41799c6524c9 (diff) |
Avoid memcpy() with same source and destination address.
The behavior of that is undefined, although unlikely to lead to problems in
practice.
Found by running regression tests with Valgrind.
Diffstat (limited to 'src/backend/utils/adt/tsvector.c')
-rw-r--r-- | src/backend/utils/adt/tsvector.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/utils/adt/tsvector.c b/src/backend/utils/adt/tsvector.c index 8a81f3d8295..dbdf0fbe251 100644 --- a/src/backend/utils/adt/tsvector.c +++ b/src/backend/utils/adt/tsvector.c @@ -124,7 +124,8 @@ uniqueentry(WordEntryIN *a, int l, char *buf, int *outbuflen) buflen += res->poslen * sizeof(WordEntryPos) + sizeof(uint16); } res++; - memcpy(res, ptr, sizeof(WordEntryIN)); + if (res != ptr) + memcpy(res, ptr, sizeof(WordEntryIN)); } else if (ptr->entry.haspos) { |