| From: | Andres Freund <andres(at)anarazel(dot)de> |
|---|---|
| To: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Likely undefined behavior with some flexible arrays |
| Date: | 2026-01-22 16:58:14 |
| Message-ID: | yjtlufdn6kaoctydjrryzt267xnls2t4lizslnbgqzhtsnohkj@fvvr3dbtvbrc |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
On 2026-01-22 11:09:37 +0500, Andrey Borodin wrote:
> > On 22 Jan 2026, at 06:56, Andres Freund <andres(at)anarazel(dot)de> wrote:
> >
> > It'd be nice to teach
> > the compile that palloc allocates, to a) get compiler warnings for things like
> > use-after-free b) warnings for things like access-beyond-allocation.
>
> Is there any chance to teach a compiler about short lived memory contexts?
I doubt that we can teach static analysis that anytime soon - I think you'd
need a compiler plugin for that. However I'd already be happy with getting
warnings for obvious stuff like using variables after being pfreed (even
indirectly) or running off the end of an allocation.
We certainly could improve the sanitizer integration with memory contexts, but
that obviously requires reaching the relevant paths in a problematic scenario
to be effective.
Greetings,
Andres Freund
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Hannu Krosing | 2026-01-22 17:05:04 | Re: Patch: dumping tables data in multiple chunks in pg_dump |
| Previous Message | Andres Freund | 2026-01-22 16:55:55 | Re: ReadRecentBuffer() doesn't scale well |