]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Guard against overly-long numeric formatting symbols from locale.
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 22 Apr 2026 16:41:00 +0000 (12:41 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 22 Apr 2026 16:41:00 +0000 (12:41 -0400)
commit580e7be88ce2b5d15df83da6496b3f23a81e3163
tree369f8d728040d01ee3e843fb592ebec620eda2c7
parent00c6e08195d5b14bd022644dba64698c2640a8e4
Guard against overly-long numeric formatting symbols from locale.

to_char() allocates its output buffer with 8 bytes per formatting
code in the pattern.  If the locale's currency symbol, thousands
separator, or decimal or sign symbol is more than 8 bytes long,
in principle we could overrun the output buffer.  No such locales
exist in the real world, so it seems sufficient to truncate the
symbol if we do see it's too long.

Reported-by: Xint Code
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/638232.1776790821@sss.pgh.pa.us
Backpatch-through: 14
src/backend/utils/adt/formatting.c