forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitfd64ed6
Unbreak overflow test for attinhcount/coninhcount
Commit90189ee narrowed pg_attribute.attinhcount andpg_constraint.coninhcount from 32 to 16 bits, but kept other relatedstructs with 32-bit wide fields: ColumnDef and CookedConstraint containan int 'inhcount' field which is itself checked for overflow onincrements, but there's no check that the values aren't above INT16_MAXbefore assigning to the catalog columns. This means that a creativeuser can get a inconsistent table definition and override someprotections.Fix it by changing those other structs to also use int16.Also, modernize style by using pg_add_s16_overflow for overflow testinginstead of checking for negative values.We also have Constraint.inhcount, which is here removed completely.This was added by commitb0e96f3 and not removed by its revert at6f8bb7c. It is not needed by the upcoming not-null constraintspatch.This is mostly academic, so we agreed not to backpatch to avoid ABIproblems.Bump catversion because of the changes to parse nodes.Co-authored-by: Álvaro Herrera <alvherre@alvh.no-ip.org>Co-authored-by: 何建 (jian he) <jian.universality@gmail.com>Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/202410081611.up4iyofb5ie7@alvherre.pgsql1 parent1909835 commitfd64ed6
File tree
8 files changed
+32
-32
lines changed- src
- backend
- catalog
- commands
- include
- catalog
- nodes
8 files changed
+32
-32
lines changedLines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
102 | 102 |
| |
103 | 103 |
| |
104 | 104 |
| |
105 |
| - | |
| 105 | + | |
106 | 106 |
| |
107 | 107 |
| |
108 | 108 |
| |
| |||
2072 | 2072 |
| |
2073 | 2073 |
| |
2074 | 2074 |
| |
2075 |
| - | |
| 2075 | + | |
2076 | 2076 |
| |
2077 | 2077 |
| |
2078 | 2078 |
| |
| |||
2624 | 2624 |
| |
2625 | 2625 |
| |
2626 | 2626 |
| |
2627 |
| - | |
2628 |
| - | |
2629 |
| - | |
2630 |
| - | |
| 2627 | + | |
| 2628 | + | |
2631 | 2629 |
| |
2632 | 2630 |
| |
2633 | 2631 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1900 | 1900 |
| |
1901 | 1901 |
| |
1902 | 1902 |
| |
1903 |
| - | |
| 1903 | + | |
1904 | 1904 |
| |
1905 | 1905 |
| |
1906 | 1906 |
| |
|
Lines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
| 30 | + | |
30 | 31 |
| |
31 | 32 |
| |
32 | 33 |
| |
| |||
74 | 75 |
| |
75 | 76 |
| |
76 | 77 |
| |
77 |
| - | |
| 78 | + | |
78 | 79 |
| |
79 | 80 |
| |
80 | 81 |
| |
| |||
849 | 850 |
| |
850 | 851 |
| |
851 | 852 |
| |
852 |
| - | |
853 |
| - | |
| 853 | + | |
| 854 | + | |
854 | 855 |
| |
855 | 856 |
| |
856 | 857 |
| |
| 858 | + | |
857 | 859 |
| |
858 | 860 |
| |
859 | 861 |
| |
|
Lines changed: 18 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
66 | 66 |
| |
67 | 67 |
| |
68 | 68 |
| |
| 69 | + | |
69 | 70 |
| |
70 | 71 |
| |
71 | 72 |
| |
| |||
3044 | 3045 |
| |
3045 | 3046 |
| |
3046 | 3047 |
| |
3047 |
| - | |
3048 |
| - | |
| 3048 | + | |
| 3049 | + | |
3049 | 3050 |
| |
3050 | 3051 |
| |
3051 | 3052 |
| |
| |||
3347 | 3348 |
| |
3348 | 3349 |
| |
3349 | 3350 |
| |
3350 |
| - | |
3351 |
| - | |
| 3351 | + | |
| 3352 | + | |
3352 | 3353 |
| |
3353 | 3354 |
| |
3354 | 3355 |
| |
| |||
7089 | 7090 |
| |
7090 | 7091 |
| |
7091 | 7092 |
| |
7092 |
| - | |
7093 |
| - | |
| 7093 | + | |
| 7094 | + | |
7094 | 7095 |
| |
7095 | 7096 |
| |
7096 | 7097 |
| |
| |||
10170 | 10171 |
| |
10171 | 10172 |
| |
10172 | 10173 |
| |
10173 |
| - | |
| 10174 | + | |
10174 | 10175 |
| |
10175 | 10176 |
| |
10176 | 10177 |
| |
| |||
10549 | 10550 |
| |
10550 | 10551 |
| |
10551 | 10552 |
| |
10552 |
| - | |
10553 |
| - | |
10554 |
| - | |
| 10553 | + | |
| 10554 | + | |
| 10555 | + | |
10555 | 10556 |
| |
10556 | 10557 |
| |
10557 | 10558 |
| |
| |||
11076 | 11077 |
| |
11077 | 11078 |
| |
11078 | 11079 |
| |
11079 |
| - | |
11080 |
| - | |
| 11080 | + | |
| 11081 | + | |
11081 | 11082 |
| |
11082 | 11083 |
| |
11083 | 11084 |
| |
| |||
15944 | 15945 |
| |
15945 | 15946 |
| |
15946 | 15947 |
| |
15947 |
| - | |
15948 |
| - | |
| 15948 | + | |
| 15949 | + | |
15949 | 15950 |
| |
15950 | 15951 |
| |
15951 | 15952 |
| |
| |||
16075 | 16076 |
| |
16076 | 16077 |
| |
16077 | 16078 |
| |
16078 |
| - | |
16079 |
| - | |
| 16079 | + | |
| 16080 | + | |
| 16081 | + | |
16080 | 16082 |
| |
16081 | 16083 |
| |
16082 | 16084 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
57 | 57 |
| |
58 | 58 |
| |
59 | 59 |
| |
60 |
| - | |
| 60 | + | |
61 | 61 |
| |
62 | 62 |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
41 | 41 |
| |
42 | 42 |
| |
43 | 43 |
| |
44 |
| - | |
| 44 | + | |
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
245 | 245 |
| |
246 | 246 |
| |
247 | 247 |
| |
248 |
| - | |
| 248 | + | |
249 | 249 |
| |
250 | 250 |
| |
251 | 251 |
| |
|
Lines changed: 1 addition & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
728 | 728 |
| |
729 | 729 |
| |
730 | 730 |
| |
731 |
| - | |
| 731 | + | |
732 | 732 |
| |
733 | 733 |
| |
734 | 734 |
| |
| |||
2754 | 2754 |
| |
2755 | 2755 |
| |
2756 | 2756 |
| |
2757 |
| - | |
2758 |
| - | |
2759 | 2757 |
| |
2760 | 2758 |
| |
2761 | 2759 |
| |
|
0 commit comments
Comments
(0)