You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This branch was automatically generated by a robot using patches from an
email thread registered at:
https://commitfest.postgresql.org/patch/5859
The branch will be overwritten each time a new patch version is posted to
the thread, and also periodically to check for bitrot caused by changes
on the master branch.
Patch(es): https://www.postgresql.org/message-id/[email protected]
Author(s): Jelte Fennema-Nio
if (cancel_key_len!=4&&conn->pversion==PG_PROTOCOL(3, 0))
1573
+
{
1574
+
libpq_append_conn_error(conn, "received invalid BackendKeyData message: cancel key length %d is different from 4, which is not supported in version 3.0 of the protocol", cancel_key_len);
1575
+
handleFatalError(conn);
1576
+
return0;
1577
+
}
1578
+
1579
+
if (cancel_key_len<4)
1580
+
{
1581
+
libpq_append_conn_error(conn, "received invalid BackendKeyData message: cancel key length %d is below minimum of 4 bytes", cancel_key_len);
1582
+
handleFatalError(conn);
1583
+
return0;
1584
+
}
1585
+
1586
+
if (cancel_key_len>256)
1587
+
{
1588
+
libpq_append_conn_error(conn, "received invalid BackendKeyData message: cancel key length %d exceeds maximum of 256 bytes", cancel_key_len);
1589
+
handleFatalError(conn);
1590
+
return0;
1591
+
}
1592
+
1550
1593
conn->be_cancel_key=malloc(cancel_key_len);
1551
1594
if (conn->be_cancel_key==NULL)
1552
1595
{
1553
1596
libpq_append_conn_error(conn, "out of memory");
1554
-
/* discard the message */
1555
-
returnEOF;
1597
+
handleFatalError(conn);
1598
+
return0;
1556
1599
}
1557
1600
if (pqGetnchar(conn->be_cancel_key, cancel_key_len, conn))
1558
1601
{
@@ -1589,10 +1632,21 @@ getNotify(PGconn *conn)
1589
1632
/* must save name while getting extra string */
1590
1633
svname=strdup(conn->workBuffer.data);
1591
1634
if (!svname)
1592
-
returnEOF;
1635
+
{
1636
+
/*
1637
+
* Notify messages can arrive at any state, so we cannot associate the
1638
+
* error with any particular query. There's no way to return back an
1639
+
* "async error", so the best we can do is drop the connection. That
1640
+
* seems better than silently ignoring the notification.
0 commit comments