postgresql-10.0/src/backend/access/transam/clog.c:234: sanity check after use ?

David Binderman <dcb314@hotmail.com>

From: David Binderman <dcb314@hotmail.com>
To: "pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Date: 2017-10-06T15:15:46Z
Lists: pgsql-bugs
Hello there,


postgresql-10.0/src/backend/access/transam/clog.c:234]: (style) Array index 'i' is used before limits check.

Source code is

        while (TransactionIdToPage(subxids[i]) == pageno && i < nsubxids)

Maybe it is better to sanity check the array index before use, not after.

Regards

David Binderman

Commits

  1. Fix access-off-end-of-array in clog.c.