- Notifications
You must be signed in to change notification settings - Fork28
Commitc0549ce
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 parentc6f8d17 commitc0549ce
1 file changed
+17
-1
lines changedLines changed: 17 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1409 | 1409 |
| |
1410 | 1410 |
| |
1411 | 1411 |
| |
1412 |
| - | |
1413 | 1412 |
| |
1414 | 1413 |
| |
1415 | 1414 |
| |
| |||
1421 | 1420 |
| |
1422 | 1421 |
| |
1423 | 1422 |
| |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
1424 | 1440 |
| |
1425 | 1441 |
| |
1426 | 1442 |
| |
|
0 commit comments
Comments
(0)