postgresql/src/backend/utils/adt
Tom Lane a7145f6bc8 Fix integer-overflow edge case detection in interval_mul and pgbench.
This patch adopts the overflow check logic introduced by commit cbdb8b4c0
into two more places.  interval_mul() failed to notice if it computed a
new microseconds value that was one more than INT64_MAX, and pgbench's
double-to-int64 logic had the same sorts of edge-case problems that
cbdb8b4c0 fixed in the core code.

To make this easier to get right in future, put the guts of the checks
into new macros in c.h, and add commentary about how to use the macros
correctly.

Back-patch to all supported branches, as we did with the previous fix.

Yuya Watari

Discussion: https://postgr.es/m/CAJ2pMkbkkFw2hb9Qb1Zj8d06EhWAQXFLy73St4qWv6aX=vqnjw@mail.gmail.com
2019-11-07 11:22:58 -05:00
..
.gitignore Revert "Add gitignore entries for jsonpath_gram.h" 2019-03-23 00:19:34 +01:00
Makefile Split all OBJS style lines in makefiles into one-line-per-entry style. 2019-11-05 14:41:07 -08:00
acl.c Add reusable routine for making arrays unique. 2019-11-07 17:00:48 +13:00
amutils.c Report progress of CREATE INDEX operations 2019-04-02 15:18:08 -03:00
array_expanded.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
array_selfuncs.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
array_typanalyze.c Split tuptoaster.c into three separate files. 2019-09-05 13:15:10 -04:00
array_userfuncs.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
arrayfuncs.c Fix inconsistencies and typos in the tree, take 11 2019-08-19 16:21:39 +09:00
arrayutils.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
ascii.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
bool.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
cash.c Fix loss of fractional digits for large values in cash_numeric(). 2019-07-26 11:59:00 -04:00
char.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
cryptohashes.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
date.c Refactor jsonpath's compareDatetime() 2019-10-21 23:07:07 +03:00
datetime.c Fix some incorrect parsing of time with time zone strings 2019-08-07 18:16:31 +09:00
datum.c Catch invalid typlens in a couple of places 2019-11-04 09:08:15 +01:00
dbsize.c Replace heapam.h includes with {table, relation}.h where applicable. 2019-01-21 10:51:37 -08:00
domains.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
encode.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
enum.c Replace uses of heap_open et al with the corresponding table_* function. 2019-01-21 10:51:37 -08:00
expandeddatum.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
expandedrecord.c Rename some toasting functions based on whether they are heap-specific. 2019-10-04 14:24:46 -04:00
float.c Fix integer-overflow edge case detection in interval_mul and pgbench. 2019-11-07 11:22:58 -05:00
format_type.c Remove unused macro 2019-02-11 10:07:25 +01:00
formatting.c Error suppression support for upcoming jsonpath .datetime() method 2019-09-25 22:51:51 +03:00
genfile.c Fix inconsistencies and typos in the tree, take 9 2019-08-05 12:14:58 +09:00
geo_ops.c Add missing commutators for distance operators 2019-07-14 14:55:01 +03:00
geo_selfuncs.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
geo_spgist.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
inet_cidr_ntop.c Avoid conflicts with library versions of inet_net_ntop() and friends. 2019-08-18 19:27:23 -04:00
inet_net_pton.c Avoid conflicts with library versions of inet_net_ntop() and friends. 2019-08-18 19:27:23 -04:00
int.c Build out the planner support function infrastructure. 2019-02-09 18:32:23 -05:00
int8.c Fix integer-overflow edge case detection in interval_mul and pgbench. 2019-11-07 11:22:58 -05:00
json.c Allow datetime values in JsonbValue 2019-09-25 22:51:51 +03:00
jsonb.c Allow datetime values in JsonbValue 2019-09-25 22:51:51 +03:00
jsonb_gin.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
jsonb_op.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
jsonb_util.c Fix implicit-fallthrough compiler warning introduced in 6dda292d4d. 2019-09-27 10:29:25 -07:00
jsonfuncs.c Fix typos in the code 2019-10-30 10:03:00 +09:00
jsonpath.c Implement jsonpath .datetime() method 2019-09-25 22:51:51 +03:00
jsonpath_exec.c Refactor jsonpath's compareDatetime() 2019-10-21 23:07:07 +03:00
jsonpath_gram.y Implement jsonpath .datetime() method 2019-09-25 22:51:51 +03:00
jsonpath_scan.l Implement jsonpath .datetime() method 2019-09-25 22:51:51 +03:00
levenshtein.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
like.c Update stale comments, and fix comment typos. 2019-06-08 10:12:26 -07:00
like_match.c Fix inconsistencies and typos in the tree 2019-07-29 12:28:30 +09:00
like_support.c Fix planner's test for case-foldable characters in ILIKE with ICU. 2019-08-12 13:15:47 -04:00
lockfuncs.c Add an isolation test to exercise parallel-worker deadlock resolution. 2019-08-01 11:50:00 -04:00
mac.c Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
mac8.c Move hash_any prototype from access/hash.h to utils/hashutils.h 2019-03-11 13:17:50 -03:00
misc.c Replace uses of heap_open et al with the corresponding table_* function. 2019-01-21 10:51:37 -08:00
name.c Collations with nondeterministic comparison 2019-03-22 12:12:43 +01:00
network.c Fix inconsistencies and typos in the tree, take 11 2019-08-19 16:21:39 +09:00
network_gist.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
network_selfuncs.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
network_spgist.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
numeric.c Add safeguards in LSN, numeric and float calculation for custom errors 2019-08-05 15:35:16 +09:00
numutils.c Initial pgindent run for v12. 2019-05-22 12:55:34 -04:00
oid.c Fix inconsistencies and typos in the tree 2019-07-22 10:01:50 +09:00
oracle_compat.c Fix many typos and inconsistencies 2019-07-01 10:00:23 +09:00
orderedsetaggs.c Collations with nondeterministic comparison 2019-03-22 12:12:43 +01:00
partitionfuncs.c Represent Lists as expansible arrays, not chains of cons-cells. 2019-07-15 13:41:58 -04:00
pg_locale.c Use libc version as a collation version on glibc systems. 2019-10-16 17:28:24 +13:00
pg_lsn.c Add safeguards in LSN, numeric and float calculation for custom errors 2019-08-05 15:35:16 +09:00
pg_upgrade_support.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
pgstatfuncs.c Return NULL for checksum failures if checksums are not enabled 2019-04-17 13:51:48 +02:00
pseudotypes.c tableam: introduce table AM infrastructure. 2019-03-06 09:54:38 -08:00
quote.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
rangetypes.c Add const qualifiers to internal range type APIs 2019-10-31 07:48:21 +01:00
rangetypes_gist.c Add const qualifiers to internal range type APIs 2019-10-31 07:48:21 +01:00
rangetypes_selfuncs.c Add const qualifiers to internal range type APIs 2019-10-31 07:48:21 +01:00
rangetypes_spgist.c Add const qualifiers to internal range type APIs 2019-10-31 07:48:21 +01:00
rangetypes_typanalyze.c Fix inconsistencies and typos in the tree, take 10 2019-08-13 13:53:41 +09:00
regexp.c Fix issues around strictness of SIMILAR TO. 2019-09-07 14:21:59 -04:00
regproc.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
ri_triggers.c Remove unused function argument 2019-11-06 08:19:27 +01:00
rowtypes.c Catch invalid typlens in a couple of places 2019-11-04 09:08:15 +01:00
ruleutils.c Rationalize use of list_concat + list_copy combinations. 2019-08-12 11:20:18 -04:00
selfuncs.c Remove some code for old unsupported versions of MSVC 2019-10-08 10:50:54 +02:00
tid.c tableam: Rename wrapper functions to match callback names. 2019-05-23 16:32:36 -07:00
timestamp.c Fix integer-overflow edge case detection in interval_mul and pgbench. 2019-11-07 11:22:58 -05:00
trigfuncs.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsginidx.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsgistidx.c Add reusable routine for making arrays unique. 2019-11-07 17:00:48 +13:00
tsquery.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsquery_cleanup.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsquery_gist.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsquery_op.c Add reusable routine for making arrays unique. 2019-11-07 17:00:48 +13:00
tsquery_rewrite.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsquery_util.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
tsrank.c Fix inconsistencies in the code 2019-07-08 13:15:09 +09:00
tsvector.c Add reusable routine for making arrays unique. 2019-11-07 17:00:48 +13:00
tsvector_op.c Add reusable routine for making arrays unique. 2019-11-07 17:00:48 +13:00
tsvector_parser.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
txid.c Add reusable routine for making arrays unique. 2019-11-07 17:00:48 +13:00
uuid.c Add gen_random_uuid function 2019-07-14 14:30:27 +02:00
varbit.c Fix bitshiftright()'s zero-padding some more. 2019-10-04 10:34:40 -04:00
varchar.c Fix up handling of nondeterministic collations with pattern_ops opclasses. 2019-09-21 16:29:17 -04:00
varlena.c Handle empty-string edge cases correctly in strpos(). 2019-10-28 12:21:13 -04:00
version.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
windowfuncs.c Phase 2 pgindent run for v12. 2019-05-22 13:04:48 -04:00
xid.c Update copyright for 2019 2019-01-02 12:44:25 -05:00
xml.c Fix nested error handling in PG_FINALLY 2019-11-07 09:56:47 +01:00