- Notifications
You must be signed in to change notification settings - Fork5k
Commit62ee703
committed
Teach contain_leaked_vars that assignment SubscriptingRefs are leaky.
array_get_element and array_get_slice qualify as leakproof, sincethey will silently return NULL for bogus subscripts. Butarray_set_element and array_set_slice throw errors for such cases,making them clearly not leakproof. contain_leaked_vars was evidentlywritten with only the former case in mind, as it gave the wrong answerfor assignment SubscriptingRefs (nee ArrayRefs).This would be a live security bug, were it not that assignmentSubscriptingRefs can only occur in INSERT and UPDATE target lists,while we only care about leakproofness for qual expressions; so thewrong answer can't occur in practice. Still, that's a rather shakyanswer for a security-related question; and maybe in future somebodywill want to ask about leakproofness of a tlist. So it seems wise tofix and even back-patch this correction.(We would need some change here anyway for the upcominggeneric-subscripting patch, since extensions might make differenttradeoffs about whether to throw errors. Commit558d77f attemptedto lay groundwork for that by asking check_functions_in_node whether aSubscriptingRef contains leaky functions; but that idea fails now thatthe implementation methods of a SubscriptingRef are not SQL-visiblefunctions that could be marked leakproof or not.)Back-patch to 9.6. While 9.5 has the same issue, the code's a bitdifferent. It seems quite unlikely that we'd introduce any actual bugin the short time 9.5 has left to live, so the work/risk/reward balanceisn't attractive for changing 9.5.Discussion:https://postgr.es/m/3143742.1607368115@sss.pgh.pa.us1 parenta676386 commit62ee703
1 file changed
+17
-1
lines changedLines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1121 | 1121 |
| |
1122 | 1122 |
| |
1123 | 1123 |
| |
1124 |
| - | |
1125 | 1124 |
| |
1126 | 1125 |
| |
1127 | 1126 |
| |
| |||
1133 | 1132 |
| |
1134 | 1133 |
| |
1135 | 1134 |
| |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
1136 | 1152 |
| |
1137 | 1153 |
| |
1138 | 1154 |
| |
|
0 commit comments
Comments
(0)