Commit f4770bc
committed
Fix GH-20733: heap buffer overflow in optimizer
Some (conditional) jump instructions can be the last one in the
op_array, because they can jump to themselves. In those cases `i + 1` in
the CFG builder can point to outside the op_array because `i` is already
the last opline.
To solve this we need to check against the end and prevent setting the
successor out of bounds.1 parent 983be08 commit f4770bc
2 files changed
+37
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
373 | 379 | | |
374 | 380 | | |
375 | | - | |
376 | 381 | | |
377 | 382 | | |
378 | 383 | | |
| |||
524 | 529 | | |
525 | 530 | | |
526 | 531 | | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
527 | 541 | | |
528 | 542 | | |
529 | | - | |
530 | 543 | | |
531 | 544 | | |
532 | 545 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
0 commit comments