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

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: dcb314(at)hotmail(dot)com
Subject: BUG #19065: postgresql-18.0/src/bin/pg_combinebackup/reconstruct.c:230: Array sanity check in wrong place ?
Date: 2025-09-26 09:48:20
Message-ID: 19065-daff7954081eddc0@postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 19065
Logged by: David Binderman
Email address: dcb314(at)hotmail(dot)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)

Browse pgsql-bugs by date

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