From: | Nikolay Shaplov <dhyan(at)nataraj(dot)su> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Alena Rybakina <a(dot)rybakina(at)postgrespro(dot)ru>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Ilia Evdokimov <ilya(dot)evdokimov(at)tantorlabs(dot)com>, kuznetsovam(at)altlinux(dot)org, nickel(at)altlinux(dot)org, egori(at)altlinux(dot)org, David Rowley <dgrowleyml(at)gmail(dot)com> |
Subject: | Re: Check for tuplestorestate nullness before dereferencing |
Date: | 2025-04-22 16:11:51 |
Message-ID: | 1901674.MHSsGVy7CF@thinkpad-pgpro |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
В письме от вторник, 22 апреля 2025 г. 18:50:49 MSK пользователь Tom Lane
написал:
> The reason that the subsequent bit of code is safe is that !forward
> should not possibly be true unless EXEC_FLAG_BACKWARD was given,
> which'd cause us to create a tuplestore. So if we were going
> to change anything, I'd propose adding something more like
>
> if (!forward && eof_tuplestore)
> {
> + Assert(node->eflags & EXEC_FLAG_BACKWARD);
> if (!node->eof_underlying)
> {
> /*
>
> or perhaps more directly, Assert that tuplestore is not null.
I like Assert(node->eflags & EXEC_FLAG_BACKWARD);
solution, it gives more information: "here we expect that BACKWARD eflag is
set". (I am not quite familiar with this part of code, this knowledge in not
obvious for me)
While Assert(tuplestorestate != NULL) gives much less information about what
is happening here.
And I think it is better to add this Assert there. People will continue using
static analyzers on postgres code, finding this place again and again. Better
to close this issue once and for all :-)
--
Nikolay Shaplov aka Nataraj
Fuzzing Engineer at Postgres Professional
Matrix IM: @dhyan:nataraj.su
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-04-22 16:20:55 | Re: Fortify float4 and float8 regression tests by ordering test results |
Previous Message | Alexander Korotkov | 2025-04-22 16:08:36 | Re: Fortify float4 and float8 regression tests by ordering test results |