Commit 6acb6ec
Extend rbran's parser robustness fixes with file-backed bounds and configurable limits (#8303)
Improve Mach-O parsing robustness and memory safety by tightening bounds checks, correctly accounting for fat-binary slice offsets, and avoiding empty-vector access. Rework the rebase/bind entry limit to derive from slice and pointer size, and centralize budget enforcement so all relocation opcodes are consistently bounded. Also simplify several reads, naming, and redundant exception handling.
Co-authored-by: rbran <git@rubens.io>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 6f8ff5a commit 6acb6ec
4 files changed
Lines changed: 216 additions & 111 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1384 | 1384 | | |
1385 | 1385 | | |
1386 | 1386 | | |
1387 | | - | |
1388 | | - | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
1389 | 1402 | | |
1390 | 1403 | | |
1391 | 1404 | | |
1392 | 1405 | | |
1393 | 1406 | | |
1394 | | - | |
1395 | | - | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
1396 | 1420 | | |
1397 | 1421 | | |
1398 | 1422 | | |
| |||
1531 | 1555 | | |
1532 | 1556 | | |
1533 | 1557 | | |
1534 | | - | |
1535 | | - | |
1536 | | - | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
1537 | 1574 | | |
1538 | 1575 | | |
1539 | 1576 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
243 | 252 | | |
244 | 253 | | |
245 | 254 | | |
246 | 255 | | |
247 | 256 | | |
248 | | - | |
| 257 | + | |
249 | 258 | | |
250 | 259 | | |
251 | 260 | | |
| |||
257 | 266 | | |
258 | 267 | | |
259 | 268 | | |
260 | | - | |
| 269 | + | |
261 | 270 | | |
262 | 271 | | |
263 | 272 | | |
| |||
269 | 278 | | |
270 | 279 | | |
271 | 280 | | |
272 | | - | |
| 281 | + | |
273 | 282 | | |
274 | 283 | | |
275 | 284 | | |
| |||
304 | 313 | | |
305 | 314 | | |
306 | 315 | | |
| 316 | + | |
| 317 | + | |
307 | 318 | | |
308 | 319 | | |
309 | 320 | | |
| |||
435 | 446 | | |
436 | 447 | | |
437 | 448 | | |
438 | | - | |
| 449 | + | |
439 | 450 | | |
440 | 451 | | |
441 | 452 | | |
| |||
0 commit comments