Commit 30cb128
committed
Prevent stack overflow in container-type functions.
A range type can name another range type as its subtype, and a record
type can bear a column of another record type. Consequently, functions
like range_cmp() and record_recv() are recursive. Functions at risk
include operator family members and referents of pg_type regproc
columns. Treat as recursive any such function that looks up and calls
the same-purpose function for a record column type or the range subtype.
Back-patch to 9.0 (all supported versions).
An array type's element type is never itself an array type, so array
functions are unaffected. Recursion depth proportional to array
dimensionality, found in array_dim_to_jsonb(), is fine thanks to MAXDIM.1 parent 08fa47c commit 30cb128
2 files changed
+26
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| 93 | + | |
| 94 | + | |
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| |||
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| 134 | + | |
| 135 | + | |
131 | 136 | | |
132 | 137 | | |
133 | 138 | | |
| |||
165 | 170 | | |
166 | 171 | | |
167 | 172 | | |
| 173 | + | |
| 174 | + | |
168 | 175 | | |
169 | 176 | | |
170 | 177 | | |
| |||
245 | 252 | | |
246 | 253 | | |
247 | 254 | | |
| 255 | + | |
| 256 | + | |
248 | 257 | | |
249 | 258 | | |
250 | 259 | | |
| |||
1142 | 1151 | | |
1143 | 1152 | | |
1144 | 1153 | | |
| 1154 | + | |
| 1155 | + | |
1145 | 1156 | | |
1146 | 1157 | | |
1147 | 1158 | | |
| |||
1221 | 1232 | | |
1222 | 1233 | | |
1223 | 1234 | | |
| 1235 | + | |
| 1236 | + | |
1224 | 1237 | | |
1225 | 1238 | | |
1226 | 1239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
| 91 | + | |
89 | 92 | | |
90 | 93 | | |
91 | 94 | | |
| |||
309 | 312 | | |
310 | 313 | | |
311 | 314 | | |
| 315 | + | |
| 316 | + | |
312 | 317 | | |
313 | 318 | | |
314 | 319 | | |
| |||
458 | 463 | | |
459 | 464 | | |
460 | 465 | | |
| 466 | + | |
| 467 | + | |
461 | 468 | | |
462 | 469 | | |
463 | 470 | | |
| |||
650 | 657 | | |
651 | 658 | | |
652 | 659 | | |
| 660 | + | |
| 661 | + | |
653 | 662 | | |
654 | 663 | | |
655 | 664 | | |
| |||
793 | 802 | | |
794 | 803 | | |
795 | 804 | | |
| 805 | + | |
| 806 | + | |
796 | 807 | | |
797 | 808 | | |
798 | 809 | | |
| |||
1029 | 1040 | | |
1030 | 1041 | | |
1031 | 1042 | | |
| 1043 | + | |
| 1044 | + | |
1032 | 1045 | | |
1033 | 1046 | | |
1034 | 1047 | | |
| |||
0 commit comments