git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 40ca907)
Fix assert in logicalmsg_desc
2022年8月16日 21:52:10 +0000 (23:52 +0200)
2022年8月16日 21:52:10 +0000 (23:52 +0200)
The assert, introduced by 9f1cf97bb5, is intended to check if the prefix
is terminated by a 0円 byte, but it has two flaws. Firstly, prefix_size
includes the 0円 byte, so prefix[prefix_size] points to the byte after
the null byte. Secondly, the check ensures the byte is not equal 0,円
while it should be checking the opposite.

Backpatch-through: 14
Discussion: https://postgr.es/m/b99b6101-2f14-3796-3dfa-4a6cd7d4326d@enterprisedb.com


diff --git a/src/backend/access/rmgrdesc/logicalmsgdesc.c b/src/backend/access/rmgrdesc/logicalmsgdesc.c
index 099e11a84e7796c0e73e8c8eb21c4bff1921b902..08e03aa30d13f15557a3c10ccf7c71bcf0c9f19a 100644 (file)
--- a/src/backend/access/rmgrdesc/logicalmsgdesc.c
+++ b/src/backend/access/rmgrdesc/logicalmsgdesc.c
@@ -28,7 +28,7 @@ logicalmsg_desc(StringInfo buf, XLogReaderState *record)
char *message = xlrec->message + xlrec->prefix_size;
char *sep = "";
- Assert(prefix[xlrec->prefix_size] != '0円');
+ Assert(prefix[xlrec->prefix_size - 1] == '0円');
appendStringInfo(buf, "%s, prefix \"%s\"; payload (%zu bytes): ",
xlrec->transactional ? "transactional" : "non-transactional",
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /