]> git.ipfire.org Git - thirdparty/dovecot/core.git/commit
lib-charset: Increase CHARSET_MAX_PENDING_BUF_SIZE to 16 bytes
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Sat, 28 Feb 2026 08:32:15 +0000 (10:32 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 3 Mar 2026 18:09:10 +0000 (18:09 +0000)
commitdb2add1b4058fd489905ea833ea31ceb4d550070
tree9edfb47931dd48762a65e529547490927c662f7c
parent035fbfa155288ac037965e0e4700eb198ccbf39a
lib-charset: Increase CHARSET_MAX_PENDING_BUF_SIZE to 16 bytes

The old 10 bytes is likely enough, but lets make it safer based on AI's
recommendation:

While the 4–8 byte rule covers most common encodings, ISO-2022 variants
(like ISO-2022-JP) are the primary reason you might need a slightly larger
buffer. Because these encodings use multi-byte "escape sequences" to switch
between character sets, iconv() may stop mid-sequence.

For standard ISO-2022 variants, a buffer of 10 to 16 bytes is generally
considered the absolute "safe" maximum for unconverted bytes.

Why 16 Bytes? While individual characters or escape sequences rarely exceed
4–6 bytes, choosing 16 bytes provides a power-of-two alignment that safely
handles even the most obscure registered ISO-IR sequences and provides a
margin for implementation-specific behavior.
src/lib-charset/charset-utf8.h
src/lib-charset/test-charset.c