Commit 4c40995
committed
In array_position()/array_positions(), beware of empty input array.
These functions incautiously fetched the array's first lower bound
even when the array is zero-dimensional, thus fetching the word
after the allocated array space. While almost always harmless,
with very bad luck this could result in SIGSEGV. Fix by adding
an early exit for empty input.
Per bug #17920 from Alexander Lakhin.
Discussion: https://postgr.es/m/17920-f7c228c627b6d02e%40postgresql.org1 parent 0553528 commit 4c40995
1 file changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1275 | 1275 | | |
1276 | 1276 | | |
1277 | 1277 | | |
1278 | | - | |
1279 | 1278 | | |
1280 | 1279 | | |
1281 | 1280 | | |
| |||
1286 | 1285 | | |
1287 | 1286 | | |
1288 | 1287 | | |
| 1288 | + | |
| 1289 | + | |
| 1290 | + | |
| 1291 | + | |
1289 | 1292 | | |
1290 | 1293 | | |
1291 | 1294 | | |
| |||
1300 | 1303 | | |
1301 | 1304 | | |
1302 | 1305 | | |
| 1306 | + | |
1303 | 1307 | | |
1304 | 1308 | | |
1305 | 1309 | | |
| |||
1425 | 1429 | | |
1426 | 1430 | | |
1427 | 1431 | | |
1428 | | - | |
1429 | | - | |
1430 | | - | |
1431 | 1432 | | |
1432 | 1433 | | |
1433 | 1434 | | |
| |||
1440 | 1441 | | |
1441 | 1442 | | |
1442 | 1443 | | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
1443 | 1448 | | |
1444 | 1449 | | |
1445 | 1450 | | |
| |||
1454 | 1459 | | |
1455 | 1460 | | |
1456 | 1461 | | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
1457 | 1465 | | |
1458 | 1466 | | |
1459 | 1467 | | |
| |||
0 commit comments