]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix race condition in gettext() initialization in libpq and ecpglib.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 Jan 2022 20:36:12 +0000 (15:36 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 21 Jan 2022 20:36:29 +0000 (15:36 -0500)
commit37f5dc8b8cb4c3a58b0cc7df36378a1fdc7a8659
treebaf90f707bda66ecf1ef576c1b42b619af881fc3
parent2c15b29f7c22231788571b5fd6671e2497e4b054
Fix race condition in gettext() initialization in libpq and ecpglib.

In libpq and ecpglib, multiple threads can concurrently enter the
initialization logic for message localization.  Since we set the
its-done flag before actually doing the work, it'd be possible
for some threads to reach gettext() before anyone has called
bindtextdomain().  Barring bugs in libintl itself, this would not
result in anything worse than failure to localize some early
messages.  Nonetheless, it's a bug, and an easy one to fix.

Noted while investigating bug #17299 from Clemens Zeidler
(much thanks to Liam Bowen for followup investigation on that).
It currently appears that that actually *is* a bug in libintl itself,
but that doesn't let us off the hook for this bit.

Back-patch to all supported versions.

Discussion: https://postgr.es/m/17299-7270741958c0b1ab@postgresql.org
Discussion: https://postgr.es/m/CAE7q7Eit4Eq2=bxce=Fm8HAStECjaXUE=WBQc-sDDcgJQ7s7eg@mail.gmail.com
src/interfaces/ecpg/ecpglib/misc.c
src/interfaces/libpq/fe-misc.c