pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix potential stack overflow in incremental backup.
3+ messages / 3 participants
[nested] [flat]

Commits from this thread:
  2024-04-11 942219996c  Fix grammar.
* pgsql: Fix potential stack overflow in incremental backup.
@ 2024-04-11 01:53  Thomas Munro <tmunro@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Thomas Munro @ 2024-04-11 01:53 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix potential stack overflow in incremental backup.

The user can set RELSEG_SIZE to a high number at compile time, so we
can't use it to control the size of an array on the stack: it could be
many gigabytes in size.  On closer inspection, we don't really need that
intermediate array anyway.  Let's just write directly into the output
array, and then perform the absolute->relative adjustment in place.
This fixes new code from commit dc212340058.

Reviewed-by: Robert Haas <robertmhaas@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKG%2B2hZ0sBztPW4mkLfng0qfkNtAHFUfxOMLizJ0BPmi5%2Bg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d8f5acbdb9b22106db583e3cbb177d34e6b18eeb

Modified Files
--------------
src/backend/backup/basebackup_incremental.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Fix potential stack overflow in incremental backup.
@ 2024-04-11 02:27  Michael Paquier <michael@paquier.xyz>
  parent: Thomas Munro <tmunro@postgresql.org>
  0 siblings, 1 reply; 3+ messages in thread

From: Michael Paquier @ 2024-04-11 02:27 UTC (permalink / raw)
  To: Thomas Munro <tmunro@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

Hi Thomas,

On Thu, Apr 11, 2024 at 01:53:24AM +0000, Thomas Munro wrote:
> Fix potential stack overflow in incremental backup.
> 
> The user can set RELSEG_SIZE to a high number at compile time, so we
> can't use it to control the size of an array on the stack: it could be
> many gigabytes in size.  On closer inspection, we don't really need that
> intermediate array anyway.  Let's just write directly into the output
> array, and then perform the absolute->relative adjustment in place.
> This fixes new code from commit dc212340058.

+ * file just as if this were not an incremental backup.  The contents of the
+ * relative_block_numbers array is unspecified in this case. 

Perhaps you mean s/is/are/ here?  The contents are what's not
specified.
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: pgsql: Fix potential stack overflow in incremental backup.
@ 2024-04-11 02:39  Thomas Munro <thomas.munro@gmail.com>
  parent: Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 3+ messages in thread

From: Thomas Munro @ 2024-04-11 02:39 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Thomas Munro <tmunro@postgresql.org>; pgsql-committers@lists.postgresql.org

On Thu, Apr 11, 2024 at 2:28 PM Michael Paquier <michael@paquier.xyz> wrote:
> + * file just as if this were not an incremental backup.  The contents of the
> + * relative_block_numbers array is unspecified in this case.
>
> Perhaps you mean s/is/are/ here?  The contents are what's not
> specified.

Thanks, fixed.  Duh.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2024-04-11 02:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-04-11 01:53 pgsql: Fix potential stack overflow in incremental backup. Thomas Munro <tmunro@postgresql.org>
2024-04-11 02:27 ` Michael Paquier <michael@paquier.xyz>
2024-04-11 02:39   ` Thomas Munro <thomas.munro@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox