1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-11 00:12:06 +03:00

Guard against overflow in make_interval().

The original code did very little to guard against integer or floating
point overflow when computing the interval's fields.  Detect any such
overflows and error out, rather than silently returning bogus results.

Joseph Koshakow, reviewed by Ashutosh Bapat and me.

Discussion: https://postgr.es/m/CAAvxfHcm1TPwH_zaGWuFoL8pZBestbRZTU6Z%3D-RvAdSXTPbKfg%40mail.gmail.com
This commit is contained in:
Dean Rasheed
2023-10-29 15:46:04 +00:00
parent 849172ff48
commit b2d55447a5
4 changed files with 71 additions and 11 deletions

View File

@@ -114,6 +114,7 @@ struct pg_itm_in
* 30 days.
*/
#define DAYS_PER_MONTH 30 /* assumes exactly 30 days per month */
#define DAYS_PER_WEEK 7
#define HOURS_PER_DAY 24 /* assume no daylight savings time changes */
/*