| From: | Thomas Munro <tmunro(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix mb2wchar functions on short input. |
| Date: | 2026-02-09 00:06:57 |
| Message-ID: | E1vpEnp-001wyx-11@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix mb2wchar functions on short input.
When converting multibyte to pg_wchar, the UTF-8 implementation would
silently ignore an incomplete final character, while the other
implementations would cast a single byte to pg_wchar, and then repeat
for the remaining byte sequence. While it didn't overrun the buffer, it
was surely garbage output.
Make all encodings behave like the UTF-8 implementation. A later change
for master only will convert this to an error, but we choose not to
back-patch that behavior change on the off-chance that someone is
relying on the existing UTF-8 behavior.
Security: CVE-2026-2006
Backpatch-through: 14
Author: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Reviewed-by: Noah Misch <noah(at)leadboat(dot)com>
Reviewed-by: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/74ee636cc93d919c845e3e3ad3642e6366ce1802
Modified Files
--------------
src/common/wchar.c | 52 ++++++++++++++++++++++++++++++++--------------------
1 file changed, 32 insertions(+), 20 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Thomas Munro | 2026-02-09 00:07:19 | pgsql: Fix encoding length for EUC_CN. |
| Previous Message | Michael Paquier | 2026-02-08 23:01:57 | pgsql: pgcrypto: Fix buffer overflow in pgp_pub_decrypt_bytea() |