From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Daniel Gustafsson <daniel(at)yesql(dot)se> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Avoid overflow with simplehash |
Date: | 2023-07-06 15:05:01 |
Message-ID: | CAEudQArof6qMDy5xLfdi9u1ZcKuJ=-kqt6nR97h5qBoj6LHZFw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Em qui., 6 de jul. de 2023 às 12:00, Daniel Gustafsson <daniel(at)yesql(dot)se>
escreveu:
> > On 6 Jul 2023, at 16:42, Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> wrote:
> > Em qui., 6 de jul. de 2023 às 11:37, Daniel Gustafsson <daniel(at)yesql(dot)se
> <mailto:daniel(at)yesql(dot)se>> escreveu:
>
> > #define SH_MAX_SIZE (((uint64) PG_UINT32_MAX) + 1)
> > This is Assert, that is, in production this test is not done.
>
> Correct, which implies that it's a test for something which is deemed
> highly
> unlikely to happen in production.
>
Highly improbable does not mean impossible, or that it will never happen.
> > If the empty element is not found, startelem has PG_UINT64_MAX value,
> > which do not fit in uint32.
>
> Can you show an example where the hash isn't grown automatically to
> accomodate
> this such that the assertion is tripped?
>
A demo won't change the fact that the function can fail, even if it isn't
currently failing.
As a precaution to avoid future bugs, I think it's necessary to apply the
patch to increase the robustness of the function.
regards,
Ranier Vilela
From | Date | Subject | |
---|---|---|---|
Next Message | Önder Kalacı | 2023-07-06 15:11:10 | Re: [Patch] Use *other* indexes on the subscriber when REPLICA IDENTITY is FULL |
Previous Message | Karina Litskevich | 2023-07-06 15:01:06 | Re: Avoid unncessary always true test (src/backend/storage/buffer/bufmgr.c) |