forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb218fbb
committed
Guard against overflow in interval_mul() and interval_div().
Commits146604e anda898b40 added overflow checks tointerval_mul(), but not to interval_div(), which contains almostidentical code, and so is susceptible to the same kinds ofoverflows. In addition, those checks did not catch all possibleoverflow conditions.Add additional checks to the "cascade down" code in interval_mul(),and copy all the overflow checks over to the corresponding code ininterval_div(), so that they both generate "interval out of range"errors, rather than returning bogus results.Given that these errors are relatively easy to hit, back-patch to allsupported branches.Per bug #18200 from Alexander Lakhin, and subsequent investigation.Discussion:https://postgr.es/m/18200-5ea288c7b2d504b1%40postgresql.org1 parent4bc8f29 commitb218fbb
File tree
3 files changed
+80
-44
lines changed- src
- backend/utils/adt
- test/regress
- expected
- sql
3 files changed
+80
-44
lines changedLines changed: 59 additions & 44 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3548 | 3548 |
| |
3549 | 3549 |
| |
3550 | 3550 |
| |
3551 |
| - | |
3552 |
| - | |
3553 |
| - | |
| 3551 | + | |
3554 | 3552 |
| |
3555 | 3553 |
| |
3556 | 3554 |
| |
3557 | 3555 |
| |
3558 |
| - | |
3559 |
| - | |
3560 |
| - | |
3561 |
| - | |
| 3556 | + | |
| 3557 | + | |
| 3558 | + | |
3562 | 3559 |
| |
3563 | 3560 |
| |
3564 | 3561 |
| |
| |||
3570 | 3567 |
| |
3571 | 3568 |
| |
3572 | 3569 |
| |
3573 |
| - | |
3574 |
| - | |
3575 |
| - | |
3576 |
| - | |
| 3570 | + | |
| 3571 | + | |
| 3572 | + | |
3577 | 3573 |
| |
3578 | 3574 |
| |
3579 | 3575 |
| |
| |||
3582 | 3578 |
| |
3583 | 3579 |
| |
3584 | 3580 |
| |
3585 |
| - | |
3586 |
| - | |
3587 |
| - | |
3588 |
| - | |
3589 |
| - | |
| 3581 | + | |
| 3582 | + | |
3590 | 3583 |
| |
3591 | 3584 |
| |
3592 | 3585 |
| |
3593 |
| - | |
3594 |
| - | |
3595 |
| - | |
3596 |
| - | |
3597 |
| - | |
| 3586 | + | |
| 3587 | + | |
3598 | 3588 |
| |
3599 | 3589 |
| |
3600 | 3590 |
| |
| |||
3628 | 3618 |
| |
3629 | 3619 |
| |
3630 | 3620 |
| |
3631 |
| - | |
| 3621 | + | |
| 3622 | + | |
| 3623 | + | |
| 3624 | + | |
3632 | 3625 |
| |
3633 | 3626 |
| |
3634 | 3627 |
| |
3635 | 3628 |
| |
3636 |
| - | |
| 3629 | + | |
| 3630 | + | |
| 3631 | + | |
3637 | 3632 |
| |
3638 | 3633 |
| |
3639 |
| - | |
3640 |
| - | |
3641 |
| - | |
| 3634 | + | |
3642 | 3635 |
| |
3643 | 3636 |
| |
3644 | 3637 |
| |
3645 |
| - | |
3646 |
| - | |
3647 |
| - | |
| 3638 | + | |
3648 | 3639 |
| |
3649 | 3640 |
| |
| 3641 | + | |
| 3642 | + | |
| 3643 | + | |
| 3644 | + | |
| 3645 | + | |
| 3646 | + | |
| 3647 | + | |
3650 | 3648 |
| |
3651 | 3649 |
| |
3652 | 3650 |
| |
| |||
3665 | 3663 |
| |
3666 | 3664 |
| |
3667 | 3665 |
| |
3668 |
| - | |
| 3666 | + | |
| 3667 | + | |
3669 | 3668 |
| |
3670 | 3669 |
| |
3671 | 3670 |
| |
| |||
3685 | 3684 |
| |
3686 | 3685 |
| |
3687 | 3686 |
| |
3688 |
| - | |
3689 |
| - | |
3690 |
| - | |
| 3687 | + | |
3691 | 3688 |
| |
3692 | 3689 |
| |
3693 | 3690 |
| |
3694 | 3691 |
| |
3695 |
| - | |
3696 |
| - | |
3697 |
| - | |
| 3692 | + | |
3698 | 3693 |
| |
3699 | 3694 |
| |
3700 | 3695 |
| |
| |||
3704 | 3699 |
| |
3705 | 3700 |
| |
3706 | 3701 |
| |
3707 |
| - | |
3708 |
| - | |
| 3702 | + | |
| 3703 | + | |
| 3704 | + | |
| 3705 | + | |
| 3706 | + | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
| 3710 | + | |
3709 | 3711 |
| |
3710 | 3712 |
| |
3711 | 3713 |
| |
| |||
3717 | 3719 |
| |
3718 | 3720 |
| |
3719 | 3721 |
| |
3720 |
| - | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
3721 | 3726 |
| |
3722 | 3727 |
| |
3723 | 3728 |
| |
3724 | 3729 |
| |
3725 |
| - | |
3726 |
| - | |
| 3730 | + | |
| 3731 | + | |
| 3732 | + | |
| 3733 | + | |
| 3734 | + | |
| 3735 | + | |
| 3736 | + | |
3727 | 3737 |
| |
3728 | 3738 |
| |
3729 |
| - | |
3730 |
| - | |
3731 |
| - | |
| 3739 | + | |
3732 | 3740 |
| |
3733 | 3741 |
| |
| 3742 | + | |
| 3743 | + | |
| 3744 | + | |
| 3745 | + | |
| 3746 | + | |
| 3747 | + | |
| 3748 | + | |
3734 | 3749 |
| |
3735 | 3750 |
| |
3736 | 3751 |
| |
|
Lines changed: 13 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
488 | 488 |
| |
489 | 489 |
| |
490 | 490 |
| |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
491 | 504 |
| |
492 | 505 |
| |
493 | 506 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
154 | 154 |
| |
155 | 155 |
| |
156 | 156 |
| |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
157 | 165 |
| |
158 | 166 |
| |
159 | 167 |
| |
|
0 commit comments
Comments
(0)