Re: BUG #16191: Errors of division by zero occur in several files. - Mailing list pgsql-bugs

From Michael Paquier
Subject Re: BUG #16191: Errors of division by zero occur in several files.
Date
Msg-id 20200106052636.GN3598@paquier.xyz
Whole thread Raw
In response to BUG #16191: Errors of division by zero occur in several files.  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
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

Attachment

pgsql-bugs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: BUG #16190: The usage of NULL pointer in refint.c
Next
From: Fahar Abbas
Date:
Subject: Re: postgresql mac operation issue 10.11