On Mon, Jan 06, 2020 at 04:00:17AM +0000, PG Bug reporting form wrote:
> We checked the codes in files “xlogreader.c”, “xlog.c”, “xlogutils.c”,
> “xlogarchive.c”, “walsender.c”, “parsexlog.c”, “pg_rewind.c”,
> “pg_resetwal.c”, “pg_waldump.c” and “receivelog.c”, and found 20 errors
> caused by the zero value used in division. There are five errors in file
> “xlogreader.c” occurring in lines 755, 769, 819, 839 and 864 and the codes
> of these five lines are the same: “XLogFileName(fname,
> state->readPageTLI, segno, state->wal_segment_size);”.
> The program should check the effectiveness (not zero) of the return value of
> function “XLogSegmentsPerXLogId” in file “xlog_internal.h” to avoid this
> type of errors.
Reading the code is one thing. Understanding it is another. Have you
actually read the code and did you notice the assumptions behind the
ranges allowed by wal_segment_size (as known as WalSegMinSize and
WalSegMaxSize defined in xlog_internal.h)?
--
Michael