]> git.ipfire.org Git - thirdparty/postgresql.git/commit
In fmtIdEnc(), handle failure of enlargePQExpBuffer().
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Feb 2025 17:46:35 +0000 (12:46 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 16 Feb 2025 17:46:35 +0000 (12:46 -0500)
commit2226a2e266dbabc5597fff5f624b3fcd71ce5fa8
tree0079406d17c677c60664d4264c8162e4a09fa723
parente782a63ccb76a8db476abb8f5d96397806e3e51b
In fmtIdEnc(), handle failure of enlargePQExpBuffer().

Coverity complained that we weren't doing that, and it's right.

This fix just makes fmtIdEnc() honor the general convention that OOM
causes a PQExpBuffer to become marked "broken", without any immediate
error.  In the pretty-unlikely case that we actually did hit OOM here,
the end result would be to return an empty string to the caller,
probably resulting in invalid SQL syntax in an issued command (if
nothing else went wrong, which is even more unlikely).  It's tempting
to throw an "out of memory" error if the buffer becomes broken, but
there's not a lot of point in doing that only here and not in hundreds
of other PQExpBuffer-using places in pg_dump and similar callers.
The whole issue could do with some non-time-crunched redesign, perhaps.

This is a followup to the fixes for CVE-2025-1094, and should be
included if cherry-picking those fixes.
src/fe_utils/string_utils.c