pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Prevent integer overflows in array subscripting calculations. 6+ messages / 1 participants [nested] [flat]
* pgsql: Prevent integer overflows in array subscripting calculations. @ 2021-05-10 14:45 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-05-10 14:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent integer overflows in array subscripting calculations. While we were (mostly) careful about ensuring that the dimensions of arrays aren't large enough to cause integer overflow, the lower bound values were generally not checked. This allows situations where lower_bound + dimension overflows an integer. It seems that that's harmless so far as array reading is concerned, except that array elements with subscripts notionally exceeding INT_MAX are inaccessible. However, it confuses various array-assignment logic, resulting in a potential for memory stomps. Fix by adding checks that array lower bounds aren't large enough to cause lower_bound + dimension to overflow. (Note: this results in disallowing cases where the last subscript position would be exactly INT_MAX. In principle we could probably allow that, but there's a lot of code that computes lower_bound + dimension and would need adjustment. It seems doubtful that it's worth the trouble/risk to allow it.) Somewhat independently of that, array_set_element() was careless about possible overflow when checking the subscript of a fixed-length array, creating a different route to memory stomps. Fix that too. Security: CVE-2021-32027 Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0c1caa48d3ccb7a5d1343b53aa32fcae45dc2d00 Modified Files -------------- src/backend/executor/execQual.c | 4 ++++ src/backend/utils/adt/array_userfuncs.c | 1 + src/backend/utils/adt/arrayfuncs.c | 40 ++++++++++++++++++++------------- src/backend/utils/adt/arrayutils.c | 27 ++++++++++++++++++++++ src/include/utils/array.h | 1 + 5 files changed, 57 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent integer overflows in array subscripting calculations. @ 2021-05-10 14:45 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-05-10 14:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent integer overflows in array subscripting calculations. While we were (mostly) careful about ensuring that the dimensions of arrays aren't large enough to cause integer overflow, the lower bound values were generally not checked. This allows situations where lower_bound + dimension overflows an integer. It seems that that's harmless so far as array reading is concerned, except that array elements with subscripts notionally exceeding INT_MAX are inaccessible. However, it confuses various array-assignment logic, resulting in a potential for memory stomps. Fix by adding checks that array lower bounds aren't large enough to cause lower_bound + dimension to overflow. (Note: this results in disallowing cases where the last subscript position would be exactly INT_MAX. In principle we could probably allow that, but there's a lot of code that computes lower_bound + dimension and would need adjustment. It seems doubtful that it's worth the trouble/risk to allow it.) Somewhat independently of that, array_set_element() was careless about possible overflow when checking the subscript of a fixed-length array, creating a different route to memory stomps. Fix that too. Security: CVE-2021-32027 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/f02b9085ad2f6fefd9c5cdf85579cb9f0ff0f0ea Modified Files -------------- src/backend/executor/execExprInterp.c | 4 ++++ src/backend/utils/adt/array_userfuncs.c | 1 + src/backend/utils/adt/arrayfuncs.c | 40 ++++++++++++++++++++------------- src/backend/utils/adt/arrayutils.c | 31 +++++++++++++++++++++++++ src/include/utils/array.h | 1 + 5 files changed, 61 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent integer overflows in array subscripting calculations. @ 2021-05-10 14:45 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-05-10 14:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent integer overflows in array subscripting calculations. While we were (mostly) careful about ensuring that the dimensions of arrays aren't large enough to cause integer overflow, the lower bound values were generally not checked. This allows situations where lower_bound + dimension overflows an integer. It seems that that's harmless so far as array reading is concerned, except that array elements with subscripts notionally exceeding INT_MAX are inaccessible. However, it confuses various array-assignment logic, resulting in a potential for memory stomps. Fix by adding checks that array lower bounds aren't large enough to cause lower_bound + dimension to overflow. (Note: this results in disallowing cases where the last subscript position would be exactly INT_MAX. In principle we could probably allow that, but there's a lot of code that computes lower_bound + dimension and would need adjustment. It seems doubtful that it's worth the trouble/risk to allow it.) Somewhat independently of that, array_set_element() was careless about possible overflow when checking the subscript of a fixed-length array, creating a different route to memory stomps. Fix that too. Security: CVE-2021-32027 Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/06bfbe85409177bff7bc5376fb5fdd7a324227c3 Modified Files -------------- src/backend/executor/execExprInterp.c | 4 ++++ src/backend/utils/adt/array_userfuncs.c | 1 + src/backend/utils/adt/arrayfuncs.c | 40 ++++++++++++++++++++------------- src/backend/utils/adt/arrayutils.c | 31 +++++++++++++++++++++++++ src/include/utils/array.h | 1 + 5 files changed, 61 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent integer overflows in array subscripting calculations. @ 2021-05-10 14:45 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-05-10 14:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent integer overflows in array subscripting calculations. While we were (mostly) careful about ensuring that the dimensions of arrays aren't large enough to cause integer overflow, the lower bound values were generally not checked. This allows situations where lower_bound + dimension overflows an integer. It seems that that's harmless so far as array reading is concerned, except that array elements with subscripts notionally exceeding INT_MAX are inaccessible. However, it confuses various array-assignment logic, resulting in a potential for memory stomps. Fix by adding checks that array lower bounds aren't large enough to cause lower_bound + dimension to overflow. (Note: this results in disallowing cases where the last subscript position would be exactly INT_MAX. In principle we could probably allow that, but there's a lot of code that computes lower_bound + dimension and would need adjustment. It seems doubtful that it's worth the trouble/risk to allow it.) Somewhat independently of that, array_set_element() was careless about possible overflow when checking the subscript of a fixed-length array, creating a different route to memory stomps. Fix that too. Security: CVE-2021-32027 Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/3b0f6a7ae5d812d9a70fc854d2e54d3657467e25 Modified Files -------------- src/backend/executor/execExprInterp.c | 4 ++++ src/backend/utils/adt/array_userfuncs.c | 1 + src/backend/utils/adt/arrayfuncs.c | 40 ++++++++++++++++++++------------- src/backend/utils/adt/arrayutils.c | 31 +++++++++++++++++++++++++ src/include/utils/array.h | 1 + 5 files changed, 61 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent integer overflows in array subscripting calculations. @ 2021-05-10 14:45 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-05-10 14:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent integer overflows in array subscripting calculations. While we were (mostly) careful about ensuring that the dimensions of arrays aren't large enough to cause integer overflow, the lower bound values were generally not checked. This allows situations where lower_bound + dimension overflows an integer. It seems that that's harmless so far as array reading is concerned, except that array elements with subscripts notionally exceeding INT_MAX are inaccessible. However, it confuses various array-assignment logic, resulting in a potential for memory stomps. Fix by adding checks that array lower bounds aren't large enough to cause lower_bound + dimension to overflow. (Note: this results in disallowing cases where the last subscript position would be exactly INT_MAX. In principle we could probably allow that, but there's a lot of code that computes lower_bound + dimension and would need adjustment. It seems doubtful that it's worth the trouble/risk to allow it.) Somewhat independently of that, array_set_element() was careless about possible overflow when checking the subscript of a fixed-length array, creating a different route to memory stomps. Fix that too. Security: CVE-2021-32027 Branch ------ REL_13_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/467395bfdf33f1ccf67ca388ffdcc927271544cb Modified Files -------------- src/backend/executor/execExprInterp.c | 4 ++++ src/backend/utils/adt/array_userfuncs.c | 1 + src/backend/utils/adt/arrayfuncs.c | 40 ++++++++++++++++++++------------- src/backend/utils/adt/arrayutils.c | 31 +++++++++++++++++++++++++ src/include/utils/array.h | 1 + 5 files changed, 61 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
* pgsql: Prevent integer overflows in array subscripting calculations. @ 2021-05-10 14:45 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 6+ messages in thread From: Tom Lane @ 2021-05-10 14:45 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Prevent integer overflows in array subscripting calculations. While we were (mostly) careful about ensuring that the dimensions of arrays aren't large enough to cause integer overflow, the lower bound values were generally not checked. This allows situations where lower_bound + dimension overflows an integer. It seems that that's harmless so far as array reading is concerned, except that array elements with subscripts notionally exceeding INT_MAX are inaccessible. However, it confuses various array-assignment logic, resulting in a potential for memory stomps. Fix by adding checks that array lower bounds aren't large enough to cause lower_bound + dimension to overflow. (Note: this results in disallowing cases where the last subscript position would be exactly INT_MAX. In principle we could probably allow that, but there's a lot of code that computes lower_bound + dimension and would need adjustment. It seems doubtful that it's worth the trouble/risk to allow it.) Somewhat independently of that, array_set_element() was careless about possible overflow when checking the subscript of a fixed-length array, creating a different route to memory stomps. Fix that too. Security: CVE-2021-32027 Branch ------ REL_10_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/2fb809d3e1927c0885ad80e18dd3a3aacd612b8b Modified Files -------------- src/backend/executor/execExprInterp.c | 4 ++++ src/backend/utils/adt/array_userfuncs.c | 1 + src/backend/utils/adt/arrayfuncs.c | 40 ++++++++++++++++++++------------- src/backend/utils/adt/arrayutils.c | 27 ++++++++++++++++++++++ src/include/utils/array.h | 1 + 5 files changed, 57 insertions(+), 16 deletions(-) ^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2021-05-10 14:45 UTC | newest] Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-05-10 14:45 pgsql: Prevent integer overflows in array subscripting calculations. Tom Lane <tgl@sss.pgh.pa.us> 2021-05-10 14:45 pgsql: Prevent integer overflows in array subscripting calculations. Tom Lane <tgl@sss.pgh.pa.us> 2021-05-10 14:45 pgsql: Prevent integer overflows in array subscripting calculations. Tom Lane <tgl@sss.pgh.pa.us> 2021-05-10 14:45 pgsql: Prevent integer overflows in array subscripting calculations. Tom Lane <tgl@sss.pgh.pa.us> 2021-05-10 14:45 pgsql: Prevent integer overflows in array subscripting calculations. Tom Lane <tgl@sss.pgh.pa.us> 2021-05-10 14:45 pgsql: Prevent integer overflows in array subscripting calculations. Tom Lane <tgl@sss.pgh.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox