pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: pg_controldata: Fix possible errors on corrupted pg_control
6+ messages / 1 participants
[nested] [flat]

* pgsql: pg_controldata: Fix possible errors on corrupted pg_control
@ 2025-02-04 22:46  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Alexander Korotkov @ 2025-02-04 22:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_controldata: Fix possible errors on corrupted pg_control

Protect against malformed timestamps.  Also protect against negative WalSegSz
as it triggers division by zero:

((0x100000000UL) / (WalSegSz)) can turn into zero in

XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,
             segno, WalSegSz);

because if WalSegSz is -1 then by arithmetic rules in C we get
0x100000000UL / 0xFFFFFFFFFFFFFFFFUL == 0.

Author: Ilyasov Ian <ianilyasov@outlook.com>
Author: Anton Voloshin <a.voloshin@postgrespro.ru>
Backpatch-through: 13

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/bin/pg_controldata/pg_controldata.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)



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

* pgsql: pg_controldata: Fix possible errors on corrupted pg_control
@ 2025-02-04 22:46  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Alexander Korotkov @ 2025-02-04 22:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_controldata: Fix possible errors on corrupted pg_control

Protect against malformed timestamps.  Also protect against negative WalSegSz
as it triggers division by zero:

((0x100000000UL) / (WalSegSz)) can turn into zero in

XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,
             segno, WalSegSz);

because if WalSegSz is -1 then by arithmetic rules in C we get
0x100000000UL / 0xFFFFFFFFFFFFFFFFUL == 0.

Author: Ilyasov Ian <ianilyasov@outlook.com>
Author: Anton Voloshin <a.voloshin@postgrespro.ru>
Backpatch-through: 13

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/bin/pg_controldata/pg_controldata.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)



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

* pgsql: pg_controldata: Fix possible errors on corrupted pg_control
@ 2025-02-04 22:46  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Alexander Korotkov @ 2025-02-04 22:46 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_controldata: Fix possible errors on corrupted pg_control

Protect against malformed timestamps.  Also protect against negative WalSegSz
as it triggers division by zero:

((0x100000000UL) / (WalSegSz)) can turn into zero in

XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,
             segno, WalSegSz);

because if WalSegSz is -1 then by arithmetic rules in C we get
0x100000000UL / 0xFFFFFFFFFFFFFFFFUL == 0.

Author: Ilyasov Ian <ianilyasov@outlook.com>
Author: Anton Voloshin <a.voloshin@postgrespro.ru>
Backpatch-through: 13

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/bin/pg_controldata/pg_controldata.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)



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

* pgsql: pg_controldata: Fix possible errors on corrupted pg_control
@ 2025-02-04 22:47  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Alexander Korotkov @ 2025-02-04 22:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_controldata: Fix possible errors on corrupted pg_control

Protect against malformed timestamps.  Also protect against negative WalSegSz
as it triggers division by zero:

((0x100000000UL) / (WalSegSz)) can turn into zero in

XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,
             segno, WalSegSz);

because if WalSegSz is -1 then by arithmetic rules in C we get
0x100000000UL / 0xFFFFFFFFFFFFFFFFUL == 0.

Author: Ilyasov Ian <ianilyasov@outlook.com>
Author: Anton Voloshin <a.voloshin@postgrespro.ru>
Backpatch-through: 13

Branch
------
REL_16_STABLE

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

Modified Files
--------------
src/bin/pg_controldata/pg_controldata.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)



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

* pgsql: pg_controldata: Fix possible errors on corrupted pg_control
@ 2025-02-04 22:47  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Alexander Korotkov @ 2025-02-04 22:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_controldata: Fix possible errors on corrupted pg_control

Protect against malformed timestamps.  Also protect against negative WalSegSz
as it triggers division by zero:

((0x100000000UL) / (WalSegSz)) can turn into zero in

XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,
             segno, WalSegSz);

because if WalSegSz is -1 then by arithmetic rules in C we get
0x100000000UL / 0xFFFFFFFFFFFFFFFFUL == 0.

Author: Ilyasov Ian <ianilyasov@outlook.com>
Author: Anton Voloshin <a.voloshin@postgrespro.ru>
Backpatch-through: 13

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1b8a9533f07a31eae6f93aa99cd996931f1b1911

Modified Files
--------------
src/bin/pg_controldata/pg_controldata.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)



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

* pgsql: pg_controldata: Fix possible errors on corrupted pg_control
@ 2025-02-04 22:47  Alexander Korotkov <akorotkov@postgresql.org>
  0 siblings, 0 replies; 6+ messages in thread

From: Alexander Korotkov @ 2025-02-04 22:47 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pg_controldata: Fix possible errors on corrupted pg_control

Protect against malformed timestamps.  Also protect against negative WalSegSz
as it triggers division by zero:

((0x100000000UL) / (WalSegSz)) can turn into zero in

XLogFileName(xlogfilename, ControlFile->checkPointCopy.ThisTimeLineID,
             segno, WalSegSz);

because if WalSegSz is -1 then by arithmetic rules in C we get
0x100000000UL / 0xFFFFFFFFFFFFFFFFUL == 0.

Author: Ilyasov Ian <ianilyasov@outlook.com>
Author: Anton Voloshin <a.voloshin@postgrespro.ru>
Backpatch-through: 13

Branch
------
master

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

Modified Files
--------------
src/bin/pg_controldata/pg_controldata.c | 25 ++++++++++++++++++-------
1 file changed, 18 insertions(+), 7 deletions(-)



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


end of thread, other threads:[~2025-02-04 22:47 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-04 22:46 pgsql: pg_controldata: Fix possible errors on corrupted pg_control Alexander Korotkov <akorotkov@postgresql.org>
2025-02-04 22:46 pgsql: pg_controldata: Fix possible errors on corrupted pg_control Alexander Korotkov <akorotkov@postgresql.org>
2025-02-04 22:46 pgsql: pg_controldata: Fix possible errors on corrupted pg_control Alexander Korotkov <akorotkov@postgresql.org>
2025-02-04 22:47 pgsql: pg_controldata: Fix possible errors on corrupted pg_control Alexander Korotkov <akorotkov@postgresql.org>
2025-02-04 22:47 pgsql: pg_controldata: Fix possible errors on corrupted pg_control Alexander Korotkov <akorotkov@postgresql.org>
2025-02-04 22:47 pgsql: pg_controldata: Fix possible errors on corrupted pg_control Alexander Korotkov <akorotkov@postgresql.org>

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