aboutsummaryrefslogtreecommitdiff
path: root/contrib/postgres_fdw/postgres_fdw.c
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2022-09-13 11:04:37 +1200
committerDavid Rowley <drowley@postgresql.org>2022-09-13 11:04:37 +1200
commit4d5d35858c898a64a96cdff62d6d1ff9f08f9fa5 (patch)
tree11d5440434510a14e10461fb477468f121afb84d /contrib/postgres_fdw/postgres_fdw.c
parent7d7d72c195e89b3eb9f9c9a03f70f9d238207c59 (diff)
downloadpostgresql-4d5d35858c898a64a96cdff62d6d1ff9f08f9fa5.tar.gz
postgresql-4d5d35858c898a64a96cdff62d6d1ff9f08f9fa5.zip
Don't reference out-of-bounds array elements in brin_minmax_multi.c
The primary fix here is to fix has_matching_range() so it does not reference ranges->values[-1] when nranges == 0. Similar problems existed in AssertCheckRanges() too. It does not look like any of these problems could lead to a crash as the array in question is at the end of the Ranges struct, and values[-1] is memory that belongs to other fields in the struct. However, let's get rid of these rather unsafe coding practices. In passing, I (David) adjusted some comments to try to make it more clear what some of the fields are for in the Ranges struct. I had to study the code to find out what nsorted was for as I couldn't tell from the comments. Author: Ranier Vilela Discussion: https://postgr.es/m/CAEudQAqJQzPitufX-jR=YUbJafpCDAKUnwgdbX_MzSc93wuvdw@mail.gmail.com Backpatch-through: 14, where multi-range brin was added.
Diffstat (limited to 'contrib/postgres_fdw/postgres_fdw.c')
0 files changed, 0 insertions, 0 deletions