This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 1473ec1
authored
Unrolled build for rust-lang#123941
Rollup merge of rust-lang#123941 - Mark-Simulacrum:fix-llvm-ub, r=nikic
Fix UB in LLVM FFI when passing zero or >1 bundle
Rust passes a `*const &OperandBundleDef` to these APIs, usually from a `Vec<&OperandBundleDef>` or so. Previously we were dereferencing that pointer and passing it to the ArrayRef constructor with some length (N).
This meant that if the length was 0, we were dereferencing a pointer to nowhere (if the vector on the Rust side didn't actually get allocated or so), and if the length was >1 then loading the *second* element somewhere in LLVM would've been reading past the end.
Since Rust can't hold OperandBundleDef by-value we're forced to indirect through a vector that copies out the OperandBundleDefs from the by-reference list on the Rust side in order to match the LLVM expected API.1 file changed
+29
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1524 | 1524 | | |
1525 | 1525 | | |
1526 | 1526 | | |
1527 | | - | |
| 1527 | + | |
1528 | 1528 | | |
1529 | 1529 | | |
1530 | 1530 | | |
| 1531 | + | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
1531 | 1539 | | |
1532 | 1540 | | |
1533 | | - | |
| 1541 | + | |
1534 | 1542 | | |
1535 | 1543 | | |
1536 | 1544 | | |
| |||
1570 | 1578 | | |
1571 | 1579 | | |
1572 | 1580 | | |
1573 | | - | |
| 1581 | + | |
1574 | 1582 | | |
1575 | 1583 | | |
1576 | 1584 | | |
| 1585 | + | |
| 1586 | + | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + | |
| 1590 | + | |
| 1591 | + | |
| 1592 | + | |
1577 | 1593 | | |
1578 | 1594 | | |
1579 | | - | |
| 1595 | + | |
1580 | 1596 | | |
1581 | 1597 | | |
1582 | 1598 | | |
| |||
1585 | 1601 | | |
1586 | 1602 | | |
1587 | 1603 | | |
1588 | | - | |
| 1604 | + | |
1589 | 1605 | | |
1590 | 1606 | | |
1591 | 1607 | | |
| |||
1597 | 1613 | | |
1598 | 1614 | | |
1599 | 1615 | | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
| 1621 | + | |
| 1622 | + | |
1600 | 1623 | | |
1601 | 1624 | | |
1602 | 1625 | | |
1603 | 1626 | | |
1604 | | - | |
| 1627 | + | |
1605 | 1628 | | |
1606 | 1629 | | |
1607 | 1630 | | |
| |||
0 commit comments