Commit 5b7ec4e
TextIOWrapper.tell() used a borrowed next_input from the snapshot across the
decoder's getstate/decode/setstate calls, so a decoder that reenters seek()
from getstate could free it and leave tell() reading freed memory. Own the
reference across those calls, matching the sibling textiowrapper_read_chunk.
(cherry picked from commit fa0ec86)
Co-authored-by: tonghuaroot (童话) <tonghuaroot@gmail.com>
1 parent f71fbc5 commit 5b7ec4e
3 files changed
Lines changed: 53 additions & 1 deletion
File tree
- Lib/test/test_io
- Misc/NEWS.d/next/Library
- Modules/_io
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1448 | 1448 | | |
1449 | 1449 | | |
1450 | 1450 | | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
| 1457 | + | |
| 1458 | + | |
| 1459 | + | |
| 1460 | + | |
| 1461 | + | |
| 1462 | + | |
| 1463 | + | |
| 1464 | + | |
| 1465 | + | |
| 1466 | + | |
| 1467 | + | |
| 1468 | + | |
| 1469 | + | |
| 1470 | + | |
| 1471 | + | |
| 1472 | + | |
| 1473 | + | |
| 1474 | + | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
| 1478 | + | |
| 1479 | + | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + | |
| 1490 | + | |
| 1491 | + | |
| 1492 | + | |
| 1493 | + | |
1451 | 1494 | | |
1452 | 1495 | | |
1453 | 1496 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2745 | 2745 | | |
2746 | 2746 | | |
2747 | 2747 | | |
2748 | | - | |
| 2748 | + | |
2749 | 2749 | | |
2750 | 2750 | | |
2751 | 2751 | | |
| |||
2797 | 2797 | | |
2798 | 2798 | | |
2799 | 2799 | | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
2800 | 2803 | | |
2801 | 2804 | | |
2802 | 2805 | | |
2803 | 2806 | | |
2804 | 2807 | | |
| 2808 | + | |
2805 | 2809 | | |
2806 | 2810 | | |
2807 | 2811 | | |
| |||
2942 | 2946 | | |
2943 | 2947 | | |
2944 | 2948 | | |
| 2949 | + | |
2945 | 2950 | | |
2946 | 2951 | | |
2947 | 2952 | | |
| |||
2954 | 2959 | | |
2955 | 2960 | | |
2956 | 2961 | | |
| 2962 | + | |
2957 | 2963 | | |
2958 | 2964 | | |
2959 | 2965 | | |
| |||
0 commit comments