pgsql: Improve handling of out-of-memory in libpq. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Improve handling of out-of-memory in libpq.
Date
Msg-id E1ZCV8F-0002QD-FN@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Improve handling of out-of-memory in libpq.

If an allocation fails in the main message handling loop, pqParseInput3
or pqParseInput2, it should not be treated as "not enough data available
yet". Otherwise libpq will wait indefinitely for more data to arrive from
the server, and gets stuck forever.

This isn't a complete fix - getParamDescriptions and getCopyStart still
have the same issue, but it's a step in the right direction.

Michael Paquier and me. Backpatch to all supported versions.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/992c6f0d2ca839ba54279fbc1a5d5e01e2e18f58

Modified Files
--------------
src/interfaces/libpq/fe-protocol2.c |   51 ++++++++++++++++++++--------
src/interfaces/libpq/fe-protocol3.c |   63 +++++++++++++++++++++++++----------
2 files changed, 83 insertions(+), 31 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Improve handling of out-of-memory in libpq.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Improve handling of out-of-memory in libpq.