BUG #19065: postgresql-18.0/src/bin/pg_combinebackup/reconstruct.c:230: Array sanity check in wrong place ? - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #19065: postgresql-18.0/src/bin/pg_combinebackup/reconstruct.c:230: Array sanity check in wrong place ?
Date
Msg-id 19065-daff7954081eddc0@postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      19065
Logged by:          David Binderman
Email address:      dcb314@hotmail.com
PostgreSQL version: 18.0
Operating system:   fedora 42
Description:

Static analyser cppcheck said:

postgresql-18.0/src/bin/pg_combinebackup/reconstruct.c:230:18: style: Array
index 'b' is used before limits check. [arrayIndexThenCheck]

Source code is

        if (sourcemap[b] == NULL && b < blocklength)

Suggest new code

        if (b < blocklength && sourcemap[b] == NULL)


pgsql-bugs by date:

Previous
From: Richard Guo
Date:
Subject: Re: BUG #19007: Planner fails to choose partial index with spurious 'not null'
Next
From: PG Bug reporting form
Date:
Subject: BUG #19066: postgresql-18.0/src/backend/optimizer/geqo/geqo_ox2.c:86: Array index check in wrong place ?