]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix mb2wchar functions on short input.
authorThomas Munro <tmunro@postgresql.org>
Sun, 25 Jan 2026 22:22:32 +0000 (11:22 +1300)
committerThomas Munro <tmunro@postgresql.org>
Sun, 8 Feb 2026 23:08:58 +0000 (12:08 +1300)
commit74ee636cc93d919c845e3e3ad3642e6366ce1802
tree0f37b059a0536cdb26a28676a19b84a7bba6be7b
parentaf79c30dc3e5369cd6d2bfdccd2c2c0ffbd60ef3
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.munro@gmail.com>
Reported-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
src/common/wchar.c