Re: BUG #16191: Errors of division by zero occur in several files.
Michael Paquier <[email protected]> Mon, 6 Jan 2020 14:26:36 +0900
| Newsgroups | gmane.comp.db.postgresql.bugs |
|---|---|
| Message-ID | <[email protected]> |
--V7BlxAaPrdhzdIM1 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 06, 2020 at 04:00:17AM +0000, PG Bug reporting form wrote: > We checked the codes in files =E2=80=9Cxlogreader.c=E2=80=9D, =E2=80=9Cxl= og.c=E2=80=9D, =E2=80=9Cxlogutils.c=E2=80=9D, > =E2=80=9Cxlogarchive.c=E2=80=9D, =E2=80=9Cwalsender.c=E2=80=9D, =E2=80=9C= parsexlog.c=E2=80=9D, =E2=80=9Cpg_rewind.c=E2=80=9D, > =E2=80=9Cpg_resetwal.c=E2=80=9D, =E2=80=9Cpg_waldump.c=E2=80=9D and =E2= =80=9Creceivelog.c=E2=80=9D, and found 20 errors > caused by the zero value used in division. There are five errors in file > =E2=80=9Cxlogreader.c=E2=80=9D occurring in lines 755, 769, 819, 839 and = 864 and the codes > of these five lines are the same: =E2=80=9CXLogFileName(fname, > state->readPageTLI, segno, state->wal_segment_size);=E2=80=9D. > The program should check the effectiveness (not zero) of the return value= of > function =E2=80=9CXLogSegmentsPerXLogId=E2=80=9D in file =E2=80=9Cxlog_in= ternal.h=E2=80=9D 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)? =20 -- Michael --V7BlxAaPrdhzdIM1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl4SxQwACgkQnvQgOdby QH26gA//TYUgsAKZ/Osf/klwPw9JrEYTmtaiMp4BitXuUqURdgjpwZNilyc1gXf6 uFVnliBhGLll+/XvVA+HN7iO1g6efMt7dbNMnKcUMV02QmcD5AbLEBq1swzeKepJ MsvAYQkXpl5vr2hiSQCN5TGoqfYdOkoj0WwRtJ2Fft4Jc8236y36Cs2Qq2Ri4Axi 2sZ/9V5BL2PCJCN0RHimcgcRqRXQEHwATWoGf/DqrwsShoabETnut49XmBOLmGwQ X0c8XQC6mjEMwDi9MBJUM0ioeFOSY/ZJL/ijj8LB4EfVjUON3mA1D3J6b21kGs99 pJNvutUtUvHy9+05Oi0BzFWgJePVABilYpGWSS3UJ/U9T+ZLQ4pKEYPygqg8zJRn YnqUqlrLYY21gxiFC/HUYUCb1wuKW74DRu6UaCA2A0xt6equbmLG0kwzi+lFAo6h AEbUPw7UhhPVy/Fg7DSKHQx6TExaAODVAvWxSDtpp+61UruT8KcW/8w6aAT4Lzz6 CnNqMrJopOCbEwT+hLnnb+y51Aqncu0fFjw7kMjHHVPGR4AQn+fasBcA9JNKiKtQ i/EX7hY0W+k8IYEx5sOFQKr2bSeC/8n2ny1o+defOFeheJ1uWOxzJlDOEuLT8KxE XGIKjGnYQbp1OO0cdPClTUnsl0I9aNlJTEDreAj9npygV6e5za4= =6NeL -----END PGP SIGNATURE----- --V7BlxAaPrdhzdIM1--