| From: | Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com> |
|---|---|
| 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 06:48:18 |
| Message-ID: | 14C36B9A-CBA3-40E1-A074-93D1B4677E46@gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
> On Nov 13, 2026, at 18:37, Peter Eisentraut <peter(at)eisentraut(dot)org> 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.
> <0001-Remove-strftime-workarounds-for-Wformat-y2k.patch><0002-Remove-strftime-workaround-for-MinGW.patch><0003-Fix-Wformat-nonliteral-warnings.patch><0004-Disable-some-Wformat-nonliteral-warnings-via-pragmas.patch><0005-Add-warning-option-Wformat-nonliteral.patch>
I tried to build with the patch set on my MacBook, no warnings found.
Overall the patch looks good to me. 0003 seems to add some redundant code, but other than using some macros to mitigate the redundancy, I don’t see other better ways. As you mentioned, that doesn’t blow the code very much, so, introducing new macros might just add unnecessary complexities.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ayush Tiwari | 2026-11-16 06:50:10 | Re: 041_checkpoint_at_promote.pl might fail due to race condition on child kill |
| Previous Message | Jingtang Zhang | 2026-11-16 06:36:07 | Re: transaction_timeout is not enforced during ClientWrite |