| From: | "Tristan Partin" <tristan(at)partin(dot)io> |
|---|---|
| To: | "Peter Eisentraut" <peter(at)eisentraut(dot)org> |
| Cc: | "pgsql-hackers" <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: -Wformat-nonliteral |
| Date: | 2026-11-16 18:59:19 |
| Message-ID: | DMWV70TRWAOH.28U8OBS3KTM5Y@partin.io |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri Nov 13, 2026 at 10:38 AM UTC, Peter Eisentraut wrote:
> This is a follow-up to CVE-2026-16240 (commit 4a18e9b5f36).
>
> That issue was found by -Wformat-nonliteral. That warning option flags
> a bunch of other places, which were fortunately not security issues. I
> think this is quite a large surface area to leave unchecked. I propose
> to fix these and turn this warning option on by default. While this
> does require introducing a bit more duplication, the patch (see patch
> 0003) overall does not blow up the code much at all (911 insertions(+),
> 896 deletions(-)).
>
> This also runs into some workarounds we had installed for strftime by
> explicitly *not* using literal format strings. The y2k-related one of
> these is definitely obsolete and can be removed (see patch 0001). The
> MinGW-related one (see patch 0002) is also obsolescent if we want to
> assume gcc 14+ for MinGW. I think for MinGW we tend to opt for only
> supporting recent toolchains, so this might be ok. Otherwise, we could
> work around this with some pragmas.
Patch 1 seems to have removal of some y2k code and using static strings
in strftime calls. Perhaps that patch should be split up?
Patch 3 might look better with a macro/function, but I'll leave it up to
you.
> errmsg_publication_relation()
It could be worth removing the explicit else at the end of the function
since it is preceded by an if () return;
Any reason to not use pg_unreachable() in errmsg_nota()?
Series looks good to me. Today I learned that that the format_arg does
not necessarily do what I thought it did!
--
Tristan Partin
PostgreSQL Contributors Team
AWS (https://aws.amazon.com)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2026-11-16 19:05:00 | Re: Add a hook for handling logical decoding messages on subscribers. |
| Previous Message | Manu | 2026-11-16 18:47:09 | Re: Do we need an index on pg_constraint.confrelid? |