forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit81eaaf6
committed
Handle zero-length sublist correctly in Python -> SQL array conversion.
If PLySequence_ToArray came across a zero-length sublist, it'd computethe overall array size as zero, possibly leading to a memory clobber.(This would likely qualify as a security bug, were it not that plpythonis an untrusted language already.)I think there are other corner-case issues in this code as well, notablythat the error messages don't match the core code and for some rangesof array sizes you'd get "invalid memory alloc request size" rather thanthe intended message about array size.Really this code has no business doing its own array size calculationat all, so remove the faulty code in favor of using ArrayGetNItems().Per bug #17912 from Alexander Lakhin. Bug seems to have come in withcommit94aceed, so back-patch to all supported branches.Discussion:https://postgr.es/m/17912-82ceed78731d9cdc@postgresql.org1 parent4dadd66 commit81eaaf6
File tree
3 files changed
+23
-16
lines changed- src/pl/plpython
- expected
- sql
3 files changed
+23
-16
lines changedLines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
687 | 687 |
| |
688 | 688 |
| |
689 | 689 |
| |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
690 | 699 |
| |
691 | 700 |
| |
692 | 701 |
| |
|
Lines changed: 7 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1136 | 1136 |
| |
1137 | 1137 |
| |
1138 | 1138 |
| |
1139 |
| - | |
| 1139 | + | |
1140 | 1140 |
| |
1141 | 1141 |
| |
1142 | 1142 |
| |
| |||
1155 | 1155 |
| |
1156 | 1156 |
| |
1157 | 1157 |
| |
1158 |
| - | |
1159 | 1158 |
| |
1160 | 1159 |
| |
1161 | 1160 |
| |
| |||
1174 | 1173 |
| |
1175 | 1174 |
| |
1176 | 1175 |
| |
1177 |
| - | |
1178 |
| - | |
1179 |
| - | |
1180 |
| - | |
1181 |
| - | |
1182 |
| - | |
1183 |
| - | |
1184 |
| - | |
1185 |
| - | |
1186 |
| - | |
1187 |
| - | |
1188 | 1176 |
| |
1189 | 1177 |
| |
1190 | 1178 |
| |
| |||
1214 | 1202 |
| |
1215 | 1203 |
| |
1216 | 1204 |
| |
1217 |
| - | |
| 1205 | + | |
1218 | 1206 |
| |
1219 | 1207 |
| |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
1220 | 1213 |
| |
1221 | 1214 |
| |
1222 | 1215 |
| |
1223 | 1216 |
| |
1224 |
| - | |
1225 |
| - | |
1226 | 1217 |
| |
1227 | 1218 |
| |
1228 | 1219 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
328 | 328 |
| |
329 | 329 |
| |
330 | 330 |
| |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
331 | 338 |
| |
332 | 339 |
| |
333 | 340 |
| |
|
0 commit comments
Comments
(0)