From a7a4adcf8d1e5a34a15ad86aee7d6aa0b8c15d43 Mon Sep 17 00:00:00 2001 From: Noah Misch Date: Fri, 6 Feb 2015 23:14:27 -0500 Subject: [PATCH] Assert(PqCommReadingMsg) in pq_peekbyte(). Interrupting pq_recvbuf() can break protocol sync, so its callers all deserve this assertion. The one pq_peekbyte() caller suffices already. --- src/backend/libpq/pqcomm.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/backend/libpq/pqcomm.c b/src/backend/libpq/pqcomm.c index 0d97aa45fbc..09dea4bbe16 100644 --- a/src/backend/libpq/pqcomm.c +++ b/src/backend/libpq/pqcomm.c @@ -928,6 +928,8 @@ pq_getbyte(void) int pq_peekbyte(void) { + Assert(PqCommReadingMsg); + while (PqRecvPointer >= PqRecvLength) { if (pq_recvbuf()) /* If nothing in buffer, then recv some */ -- 2.30.2