pgsql: ecpg: Fix out-of-bound writes due to processing of invalid bytea

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: ecpg: Fix out-of-bound writes due to processing of invalid bytea
Date: 2026-08-10 13:41:32
Message-ID: E1wtQFw-00000000yNz-3OWq@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

ecpg: Fix out-of-bound writes due to processing of invalid bytea data

ECPG assumes that any bytea data it receives from a backend starts with
'\x' as its first two bytes, but a check was missed to enforce that. A
rogue server sending some garbage bytea data would be able to crash a
client, resulting in a client-side DoS, in the most common cases.

Reported-by: ylwangtju <ylwangtju(at)qq(dot)com>
Backpatch-through: 14
Security: CVE-2026-16241

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/74c59d062ad7a99fb90e38390e7d5b90e7a69527
Author: Michael Paquier <michael(at)paquier(dot)xyz>

Modified Files
--------------
src/interfaces/ecpg/ecpglib/data.c | 7 ++++++
src/interfaces/ecpg/ecpglib/error.c | 7 ++++++
src/interfaces/ecpg/include/ecpgerrno.h | 1 +
src/interfaces/ecpg/test/expected/sql-bytea.c | 27 ++++++++++++++++++----
src/interfaces/ecpg/test/expected/sql-bytea.stderr | 24 ++++++++++++++++++-
src/interfaces/ecpg/test/sql/bytea.pgc | 5 ++++
6 files changed, 66 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-08-10 13:41:33 pgsql: Invalidate plan cache after role changes.
Previous Message Noah Misch 2026-08-10 13:41:31 pgsql: Avoid overflow in Levenshtein distance calculations.