Re: Non-replayable WAL records through overflows and >MaxAllocSize lengths

From: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Andres Freund <andres(at)anarazel(dot)de>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, David Zhang <david(dot)zhang(at)highgo(dot)ca>, Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Non-replayable WAL records through overflows and >MaxAllocSize lengths
Date: 2023-04-06 23:50:00
Message-ID: CAEze2WjSPUnyFm-NO1q9Kufs3+UwesBDMo-m9_TpwXjqTPZe6w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 7 Apr 2023, 01:35 Michael Paquier, <michael(at)paquier(dot)xyz> wrote:

> On Fri, Apr 07, 2023 at 08:08:34AM +0900, Michael Paquier wrote:
> > So bumping mainrdata_len to uint64 is actually not entirely in line
> > with this code. Well, it will work because we'd still fail a couple
> > of lines down, but perhaps its readability should be improved so as
> > we have an extra check in this code path to make sure that
> > mainrdata_len is not higher than PG_UINT32_MAX, then use an
> > intermediate casted variable before saving the length in the record
> > data to make clear that the type of the main static length in
> > xloginsert.c is not the same as what a record has? The v10 I sent
> > previously blocked this possibility, but not v11.
>

Yes, that was a bad oversight, which would've shown up in tests on a system
with an endianness that my computer doesn't have...

> So, I was thinking about something like the attached tweaking this
> point, the error details a bit, applying an indentation and writing a
> commit message... Matthias?
>

That looks fine to me. Thanks for picking this up and fixing the issue.

Kind regards,

Matthias van de Meent

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-04-06 23:59:22 Re: Non-replayable WAL records through overflows and >MaxAllocSize lengths
Previous Message Cary Huang 2023-04-06 23:41:43 Re: pg_recvlogical prints bogus error when interrupted