pgsql: Fix mb2wchar functions on short input.
pgsql: Fix mb2wchar functions on short input.
От:
Thomas Munro <tmunro@postgresql.org>
Дата:
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 Reported-by: Noah Misch Reviewed-by: Noah Misch Reviewed-by: Heikki Linnakangas Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/6ed116046dcfaca5ee1684a0ef0c7c98a345c3b9 Modified Files -------------- src/common/wchar.c | 52 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 20 deletions(-)