Repository navigation
Commit db87281
committed
Fix UAF for gc debug print
In both uncollectable and collectables we would
iterate through gc items using `GC_NEXT(gc)`.
However in the case the current item was cleaned
during iteration this would reuslt in UAF when
fetching the next step in the loop.
The fix is to move each item to a temporary `seen`
list before printing it, and always take the next
item from the head of the original list, so the
loop never reads from a freed item. This takes
a similar approach to `finalize_garbage()`.1 parent 036d309 commit db87281
3 files changed
Lines changed: 90 additions & 10 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/Core_and_Builtins
- Python
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
356 | 418 | | |
357 | 419 | | |
358 | 420 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1003 | 1003 | | |
1004 | 1004 | | |
1005 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
1006 | 1027 | | |
1007 | 1028 | | |
1008 | 1029 | | |
| |||
1435 | 1456 | | |
1436 | 1457 | | |
1437 | 1458 | | |
1438 | | - | |
1439 | 1459 | | |
1440 | 1460 | | |
1441 | 1461 | | |
| |||
1558 | 1578 | | |
1559 | 1579 | | |
1560 | 1580 | | |
1561 | | - | |
1562 | | - | |
1563 | | - | |
| 1581 | + | |
1564 | 1582 | | |
1565 | 1583 | | |
1566 | 1584 | | |
| |||
1603 | 1621 | | |
1604 | 1622 | | |
1605 | 1623 | | |
1606 | | - | |
1607 | | - | |
1608 | | - | |
1609 | | - | |
1610 | | - | |
| 1624 | + | |
| 1625 | + | |
1611 | 1626 | | |
1612 | | - | |
| 1627 | + | |
1613 | 1628 | | |
1614 | 1629 | | |
1615 | 1630 | | |
| |||
0 commit comments