pgsql: Fix potential stack overflow in incremental backup.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix potential stack overflow in incremental backup.
Date: 2024-04-11 01:53:24
Message-ID: E1rujcx-001X28-QA@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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(at)gmail(dot)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(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2024-04-11 02:27:54 Re: pgsql: Fix potential stack overflow in incremental backup.
Previous Message Michael Paquier 2024-04-11 00:21:46 pgsql: Fix inconsistency with replay of hash squeeze record for clean b