| From: | Jacob Champion <jacob(dot)champion(at)enterprisedb(dot)com> |
|---|---|
| To: | Andreas Karlsson <andreas(at)proxel(dot)se> |
| Cc: | Галкин Сергей <galkin(at)rutoken(dot)ru>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: DEREF_AFTER_NULL: src/common/jsonapi.c:2529 |
| Date: | 2026-04-06 17:57:22 |
| Message-ID: | CAOYmi+muy=Wtk0dv6J5HmcFTMvrPMe2MGN2X+hjZL7DKSUEXLQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Apr 6, 2026 at 4:59 AM Andreas Karlsson <andreas(at)proxel(dot)se> wrote:
> The code is correct but a bit confusing.
Yeah, it's not great. The need for this (security-critical!) code to
wrangle three separate allocation conventions is error-prone, to say
the least.
> If someone has a patch improving readability
Suggestions?
> adding this noop NULL check to silence a false positive from a
> static analyzer does not seem like an improvement.
We do occasionally merge code to silence false positives, and we could
maybe do something with pg_assume() here, but I agree that it'd be
better to refactor it so that it's obviously correct.
--Jacob
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Haibo Yan | 2026-04-06 17:57:38 | Re: Extract numeric filed in JSONB more effectively |
| Previous Message | Mihail Nikalayeu | 2026-04-06 17:55:00 | Re: Resetting snapshots during the first phase of [CREATE |RE]INDEX CONCURRENTLY |