| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | -Wformat-nonliteral |
| Date: | 2026-11-13 10:37:40 |
| Message-ID: | b3459224-1ebe-45c1-89a5-763b917ea0c3@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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.
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Remove-strftime-workarounds-for-Wformat-y2k.patch | text/plain | 5.7 KB |
| 0002-Remove-strftime-workaround-for-MinGW.patch | text/plain | 1.7 KB |
| 0003-Fix-Wformat-nonliteral-warnings.patch | text/plain | 101.1 KB |
| 0004-Disable-some-Wformat-nonliteral-warnings-via-pragmas.patch | text/plain | 4.3 KB |
| 0005-Add-warning-option-Wformat-nonliteral.patch | text/plain | 2.0 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | vignesh C | 2026-11-13 10:41:53 | Re: Hash index: stop registering pin-only bucket pages in WAL (remove REGBUF_NO_CHANGE) |
| Previous Message | Jan Nidzwetzki | 2026-11-13 10:31:05 | Re: Prevent object capture in CREATE/ALTER EXTENSION scripts |