pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix handling of invalidly encoded data in escaping functions
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix handling of invalidly encoded data in escaping functions
@ 2025-02-10 15:09  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Andres Freund @ 2025-02-10 15:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of invalidly encoded data in escaping functions

Previously invalidly encoded input to various escaping functions could lead to
the escaped string getting incorrectly parsed by psql.  To be safe, escaping
functions need to ensure that neither invalid nor incomplete multi-byte
characters can be used to "escape" from being quoted.

Functions which can report errors now return an error in more cases than
before. Functions that cannot report errors now replace invalid input bytes
with a byte sequence that cannot be used to escape the quotes and that is
guaranteed to error out when a query is sent to the server.

The following functions are fixed by this commit:
- PQescapeLiteral()
- PQescapeIdentifier()
- PQescapeString()
- PQescapeStringConn()
- fmtId()
- appendStringLiteral()

Reported-by: Stephen Fewer <stephen_fewer@rapid7.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 13
Security: CVE-2025-1094

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5dc1e42b4fa6a4434afa7d7cdcf0291351a7b873

Modified Files
--------------
src/fe_utils/string_utils.c    | 170 ++++++++++++++++++++++++++++++++---------
src/interfaces/libpq/fe-exec.c | 134 +++++++++++++++++++++++---------
2 files changed, 236 insertions(+), 68 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of invalidly encoded data in escaping functions
@ 2025-02-10 15:09  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Andres Freund @ 2025-02-10 15:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of invalidly encoded data in escaping functions

Previously invalidly encoded input to various escaping functions could lead to
the escaped string getting incorrectly parsed by psql.  To be safe, escaping
functions need to ensure that neither invalid nor incomplete multi-byte
characters can be used to "escape" from being quoted.

Functions which can report errors now return an error in more cases than
before. Functions that cannot report errors now replace invalid input bytes
with a byte sequence that cannot be used to escape the quotes and that is
guaranteed to error out when a query is sent to the server.

The following functions are fixed by this commit:
- PQescapeLiteral()
- PQescapeIdentifier()
- PQescapeString()
- PQescapeStringConn()
- fmtId()
- appendStringLiteral()

Reported-by: Stephen Fewer <stephen_fewer@rapid7.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 13
Security: CVE-2025-1094

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/92e4170f421832208a75645f4a4ea94494bdad4d

Modified Files
--------------
src/fe_utils/string_utils.c    | 170 ++++++++++++++++++++++++++++++++---------
src/interfaces/libpq/fe-exec.c | 134 +++++++++++++++++++++++---------
2 files changed, 236 insertions(+), 68 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of invalidly encoded data in escaping functions
@ 2025-02-10 15:09  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Andres Freund @ 2025-02-10 15:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of invalidly encoded data in escaping functions

Previously invalidly encoded input to various escaping functions could lead to
the escaped string getting incorrectly parsed by psql.  To be safe, escaping
functions need to ensure that neither invalid nor incomplete multi-byte
characters can be used to "escape" from being quoted.

Functions which can report errors now return an error in more cases than
before. Functions that cannot report errors now replace invalid input bytes
with a byte sequence that cannot be used to escape the quotes and that is
guaranteed to error out when a query is sent to the server.

The following functions are fixed by this commit:
- PQescapeLiteral()
- PQescapeIdentifier()
- PQescapeString()
- PQescapeStringConn()
- fmtId()
- appendStringLiteral()

Reported-by: Stephen Fewer <stephen_fewer@rapid7.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 13
Security: CVE-2025-1094

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/43a77239d412db194a69b18b7850580e3b78218f

Modified Files
--------------
src/fe_utils/string_utils.c    | 170 ++++++++++++++++++++++++++++++++---------
src/interfaces/libpq/fe-exec.c | 134 +++++++++++++++++++++++---------
2 files changed, 236 insertions(+), 68 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of invalidly encoded data in escaping functions
@ 2025-02-10 15:09  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Andres Freund @ 2025-02-10 15:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of invalidly encoded data in escaping functions

Previously invalidly encoded input to various escaping functions could lead to
the escaped string getting incorrectly parsed by psql.  To be safe, escaping
functions need to ensure that neither invalid nor incomplete multi-byte
characters can be used to "escape" from being quoted.

Functions which can report errors now return an error in more cases than
before. Functions that cannot report errors now replace invalid input bytes
with a byte sequence that cannot be used to escape the quotes and that is
guaranteed to error out when a query is sent to the server.

The following functions are fixed by this commit:
- PQescapeLiteral()
- PQescapeIdentifier()
- PQescapeString()
- PQescapeStringConn()
- fmtId()
- appendStringLiteral()

Reported-by: Stephen Fewer <stephen_fewer@rapid7.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 13
Security: CVE-2025-1094

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e0ef3d776a349db2c63075241626563b79477bd4

Modified Files
--------------
src/fe_utils/string_utils.c    | 170 ++++++++++++++++++++++++++++++++---------
src/interfaces/libpq/fe-exec.c | 135 +++++++++++++++++++++++---------
2 files changed, 237 insertions(+), 68 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of invalidly encoded data in escaping functions
@ 2025-02-10 15:09  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Andres Freund @ 2025-02-10 15:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of invalidly encoded data in escaping functions

Previously invalidly encoded input to various escaping functions could lead to
the escaped string getting incorrectly parsed by psql.  To be safe, escaping
functions need to ensure that neither invalid nor incomplete multi-byte
characters can be used to "escape" from being quoted.

Functions which can report errors now return an error in more cases than
before. Functions that cannot report errors now replace invalid input bytes
with a byte sequence that cannot be used to escape the quotes and that is
guaranteed to error out when a query is sent to the server.

The following functions are fixed by this commit:
- PQescapeLiteral()
- PQescapeIdentifier()
- PQescapeString()
- PQescapeStringConn()
- fmtId()
- appendStringLiteral()

Reported-by: Stephen Fewer <stephen_fewer@rapid7.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 13
Security: CVE-2025-1094

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/370c94d4cce179736f9a255779eb8e653e1edfb2

Modified Files
--------------
src/fe_utils/string_utils.c    | 170 ++++++++++++++++++++++++++++++++---------
src/interfaces/libpq/fe-exec.c | 135 +++++++++++++++++++++++---------
2 files changed, 237 insertions(+), 68 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Fix handling of invalidly encoded data in escaping functions
@ 2025-02-10 15:09  Andres Freund <andres@anarazel.de>
  0 siblings, 0 replies; 6+ messages in thread

From: Andres Freund @ 2025-02-10 15:09 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix handling of invalidly encoded data in escaping functions

Previously invalidly encoded input to various escaping functions could lead to
the escaped string getting incorrectly parsed by psql.  To be safe, escaping
functions need to ensure that neither invalid nor incomplete multi-byte
characters can be used to "escape" from being quoted.

Functions which can report errors now return an error in more cases than
before. Functions that cannot report errors now replace invalid input bytes
with a byte sequence that cannot be used to escape the quotes and that is
guaranteed to error out when a query is sent to the server.

The following functions are fixed by this commit:
- PQescapeLiteral()
- PQescapeIdentifier()
- PQescapeString()
- PQescapeStringConn()
- fmtId()
- appendStringLiteral()

Reported-by: Stephen Fewer <stephen_fewer@rapid7.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Backpatch-through: 13
Security: CVE-2025-1094

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/c906bfe1b87280ab5b94d5d84e7cd019a1ff09d3

Modified Files
--------------
src/fe_utils/string_utils.c    | 170 ++++++++++++++++++++++++++++++++---------
src/interfaces/libpq/fe-exec.c | 136 ++++++++++++++++++++++++---------
2 files changed, 238 insertions(+), 68 deletions(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2025-02-10 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-10 15:09 pgsql: Fix handling of invalidly encoded data in escaping functions Andres Freund <andres@anarazel.de>
2025-02-10 15:09 pgsql: Fix handling of invalidly encoded data in escaping functions Andres Freund <andres@anarazel.de>
2025-02-10 15:09 pgsql: Fix handling of invalidly encoded data in escaping functions Andres Freund <andres@anarazel.de>
2025-02-10 15:09 pgsql: Fix handling of invalidly encoded data in escaping functions Andres Freund <andres@anarazel.de>
2025-02-10 15:09 pgsql: Fix handling of invalidly encoded data in escaping functions Andres Freund <andres@anarazel.de>
2025-02-10 15:09 pgsql: Fix handling of invalidly encoded data in escaping functions Andres Freund <andres@anarazel.de>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox