diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2022-02-28 15:36:54 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2022-02-28 15:36:54 -0500 |
commit | 54bd1e43ca56e323aef309dc2dc0e1391825ce68 (patch) | |
tree | 95a9580dc560d5487f10f32a9633f230566243d2 /src/backend/utils/adt/numeric.c | |
parent | a59c79564bdc209a5bc7b02d706f0d7352eb82fa (diff) | |
download | postgresql-54bd1e43ca56e323aef309dc2dc0e1391825ce68.tar.gz postgresql-54bd1e43ca56e323aef309dc2dc0e1391825ce68.zip |
Handle integer overflow in interval justification functions.
justify_interval, justify_hours, and justify_days didn't check for
overflow when promoting hours to days or days to months; but that's
possible when the upper field's value is already large. Detect and
report any such overflow.
Also, we can avoid unnecessary overflow in some cases in justify_interval
by pre-justifying the days field. (Thanks to Nathan Bossart for this
idea.)
Joe Koshakow
Discussion: https://postgr.es/m/CAAvxfHeNqsJ2xYFbPUf_8nNQUiJqkag04NW6aBQQ0dbZsxfWHA@mail.gmail.com
Diffstat (limited to 'src/backend/utils/adt/numeric.c')
0 files changed, 0 insertions, 0 deletions