]> granicus.if.org Git - postgresql/commit
pg_resetwal: Prevent division-by-zero errors
authorPeter Eisentraut <peter_e@gmx.net>
Fri, 23 Mar 2018 14:10:49 +0000 (10:10 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Fri, 23 Mar 2018 14:14:25 +0000 (10:14 -0400)
commitf1a074b146c900bd439b6ef1953866f41b61a669
tree74f406efef1cd8cadccb2c5c841abc712b5413b4
parent86f575948c773b0ec5b0f27066e37dd93a7f0a96
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
src/bin/pg_resetwal/pg_resetwal.c
src/bin/pg_resetwal/t/002_corrupted.pl [new file with mode: 0644]