Thread: pgsql: pg_resetwal: Prevent division-by-zero errors

pgsql: pg_resetwal: Prevent division-by-zero errors

From
Peter Eisentraut
Date:
pg_resetwal: Prevent division-by-zero errors

Handle the case where the pg_control file specifies a WAL segment size
of 0 bytes.  This would previously have led to a division by zero error.
Change this to assume the whole file is corrupt and go to guess
everything.

Discussion: https://www.postgresql.org/message-id/a6163ad7-cc99-fdd1-dfad-25df73032ab8%402ndquadrant.com

Branch
------
master

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

Modified Files
--------------
src/bin/pg_resetwal/pg_resetwal.c      |  4 +--
src/bin/pg_resetwal/t/002_corrupted.pl | 47 ++++++++++++++++++++++++++++++++++
2 files changed, 49 insertions(+), 2 deletions(-)