forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0a27c3d
committed
Fix various overflow hazards in date and timestamp functions.
This commit makes use of the overflow-aware routines in int.h tofix a variety of reported overflow bugs in the date and timestampcode. It seems unlikely that this fixes all such bugs in thisarea, but since the problems seem limited to cases that are farbeyond any realistic usage, I'm not going to worry too much. Notethat for one bug, I've chosen to simply add a comment about theoverflow hazard because fixing it would require quite a bit of coderestructuring that doesn't seem worth the risk.Since this is a bug fix, it could be back-patched, but given therisk of conflicts with the new routines in int.h and the overallrisk/reward ratio of this patch, I've opted not to do so for now.Fixes bug #18585 (except for the one case that's just commented).Reported-by: Alexander LakhinAuthor: Matthew Kim, Nathan BossartReviewed-by: Joseph Koshakow, Jian HeDiscussion:https://postgr.es/m/31ad2cd1-db94-bdb3-f91a-65ffdb4bef95%40gmail.comDiscussion:https://postgr.es/m/18585-db646741dd649abd%40postgresql.org1 parent3eea7a0 commit0a27c3d
File tree
8 files changed
+179
-9
lines changed- src
- backend/utils/adt
- include/common
- test/regress
- expected
- sql
8 files changed
+179
-9
lines changedLines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
256 | 256 |
| |
257 | 257 |
| |
258 | 258 |
| |
| 259 | + | |
| 260 | + | |
259 | 261 |
| |
260 |
| - | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
261 | 268 |
| |
262 | 269 |
| |
263 | 270 |
| |
|
Lines changed: 92 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
77 | 77 |
| |
78 | 78 |
| |
79 | 79 |
| |
| 80 | + | |
80 | 81 |
| |
81 | 82 |
| |
82 | 83 |
| |
| |||
3826 | 3827 |
| |
3827 | 3828 |
| |
3828 | 3829 |
| |
3829 |
| - | |
| 3830 | + | |
| 3831 | + | |
| 3832 | + | |
| 3833 | + | |
| 3834 | + | |
| 3835 | + | |
| 3836 | + | |
| 3837 | + | |
3830 | 3838 |
| |
3831 | 3839 |
| |
3832 | 3840 |
| |
| |||
4785 | 4793 |
| |
4786 | 4794 |
| |
4787 | 4795 |
| |
| 4796 | + | |
| 4797 | + | |
4788 | 4798 |
| |
4789 |
| - | |
| 4799 | + | |
| 4800 | + | |
| 4801 | + | |
| 4802 | + | |
| 4803 | + | |
| 4804 | + | |
| 4805 | + | |
| 4806 | + | |
| 4807 | + | |
| 4808 | + | |
| 4809 | + | |
| 4810 | + | |
4790 | 4811 |
| |
4791 |
| - | |
| 4812 | + | |
| 4813 | + | |
| 4814 | + | |
| 4815 | + | |
| 4816 | + | |
| 4817 | + | |
| 4818 | + | |
| 4819 | + | |
| 4820 | + | |
| 4821 | + | |
| 4822 | + | |
| 4823 | + | |
| 4824 | + | |
4792 | 4825 |
| |
4793 | 4826 |
| |
4794 | 4827 |
| |
| |||
4814 | 4847 |
| |
4815 | 4848 |
| |
4816 | 4849 |
| |
| 4850 | + | |
4817 | 4851 |
| |
4818 |
| - | |
| 4852 | + | |
| 4853 | + | |
| 4854 | + | |
| 4855 | + | |
| 4856 | + | |
| 4857 | + | |
| 4858 | + | |
| 4859 | + | |
| 4860 | + | |
| 4861 | + | |
4819 | 4862 |
| |
| 4863 | + | |
4820 | 4864 |
| |
4821 |
| - | |
| 4865 | + | |
| 4866 | + | |
| 4867 | + | |
| 4868 | + | |
| 4869 | + | |
| 4870 | + | |
| 4871 | + | |
| 4872 | + | |
| 4873 | + | |
| 4874 | + | |
4822 | 4875 |
| |
4823 | 4876 |
| |
4824 | 4877 |
| |
| |||
4843 | 4896 |
| |
4844 | 4897 |
| |
4845 | 4898 |
| |
4846 |
| - | |
| 4899 | + | |
| 4900 | + | |
| 4901 | + | |
| 4902 | + | |
| 4903 | + | |
| 4904 | + | |
| 4905 | + | |
| 4906 | + | |
| 4907 | + | |
| 4908 | + | |
| 4909 | + | |
4847 | 4910 |
| |
4848 | 4911 |
| |
4849 | 4912 |
| |
4850 |
| - | |
| 4913 | + | |
| 4914 | + | |
| 4915 | + | |
| 4916 | + | |
| 4917 | + | |
| 4918 | + | |
| 4919 | + | |
| 4920 | + | |
| 4921 | + | |
| 4922 | + | |
| 4923 | + | |
4851 | 4924 |
| |
4852 | 4925 |
| |
4853 | 4926 |
| |
| |||
4912 | 4985 |
| |
4913 | 4986 |
| |
4914 | 4987 |
| |
4915 |
| - | |
| 4988 | + | |
| 4989 | + | |
| 4990 | + | |
| 4991 | + | |
| 4992 | + | |
| 4993 | + | |
| 4994 | + | |
| 4995 | + | |
| 4996 | + | |
| 4997 | + | |
| 4998 | + | |
| 4999 | + | |
4916 | 5000 |
| |
4917 | 5001 |
| |
4918 | 5002 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5104 | 5104 |
| |
5105 | 5105 |
| |
5106 | 5106 |
| |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
| 5110 | + | |
5107 | 5111 |
| |
5108 | 5112 |
| |
5109 | 5113 |
| |
|
Lines changed: 48 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
120 | 136 |
| |
121 | 137 |
| |
122 | 138 |
| |
| |||
185 | 201 |
| |
186 | 202 |
| |
187 | 203 |
| |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
188 | 220 |
| |
189 | 221 |
| |
190 | 222 |
| |
| |||
300 | 332 |
| |
301 | 333 |
| |
302 | 334 |
| |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
303 | 351 |
| |
304 | 352 |
| |
305 | 353 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1528 | 1528 |
| |
1529 | 1529 |
| |
1530 | 1530 |
| |
| 1531 | + | |
| 1532 | + | |
1531 | 1533 |
| |
1532 | 1534 |
| |
1533 | 1535 |
| |
|
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3754 | 3754 |
| |
3755 | 3755 |
| |
3756 | 3756 |
| |
| 3757 | + | |
| 3758 | + | |
| 3759 | + | |
| 3760 | + | |
| 3761 | + | |
| 3762 | + | |
| 3763 | + | |
| 3764 | + | |
3757 | 3765 |
| |
3758 | 3766 |
| |
3759 | 3767 |
| |
| |||
3794 | 3802 |
| |
3795 | 3803 |
| |
3796 | 3804 |
| |
| 3805 | + | |
| 3806 | + | |
| 3807 | + | |
| 3808 | + | |
| 3809 | + | |
| 3810 | + | |
| 3811 | + | |
| 3812 | + | |
3797 | 3813 |
| |
3798 | 3814 |
| |
3799 | 3815 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
371 | 371 |
| |
372 | 372 |
| |
373 | 373 |
| |
| 374 | + | |
374 | 375 |
| |
375 | 376 |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
651 | 651 |
| |
652 | 652 |
| |
653 | 653 |
| |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
654 | 658 |
| |
655 | 659 |
| |
656 | 660 |
| |
| |||
661 | 665 |
| |
662 | 666 |
| |
663 | 667 |
| |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
664 | 672 |
| |
665 | 673 |
| |
666 | 674 |
| |
|
0 commit comments
Comments
(0)