Commit a8e2bc8
bpo-38876: Raise pickle.UnpicklingError when loading an item from memo for invalid input (pythonGH-17335)
The previous code was raising a `KeyError` for both the Python and C implementation.
This was caused by the specified index of an invalid input which did not exist
in the memo structure, where the pickle stores what objects it has seen.
The malformed input would have caused either a `BINGET` or `LONG_BINGET` load
from the memo, leading to a `KeyError` as the determined index was bogus.
https://bugs.python.org/issue38876
https://bugs.python.org/issue388761 parent af6c25d commit a8e2bc8
4 files changed
Lines changed: 35 additions & 8 deletions
File tree
- Lib
- test
- Misc/NEWS.d/next/Library
- Modules
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1604 | 1604 | | |
1605 | 1605 | | |
1606 | 1606 | | |
1607 | | - | |
| 1607 | + | |
| 1608 | + | |
| 1609 | + | |
| 1610 | + | |
| 1611 | + | |
1608 | 1612 | | |
1609 | 1613 | | |
1610 | 1614 | | |
1611 | 1615 | | |
1612 | | - | |
| 1616 | + | |
| 1617 | + | |
| 1618 | + | |
| 1619 | + | |
| 1620 | + | |
1613 | 1621 | | |
1614 | 1622 | | |
1615 | 1623 | | |
1616 | 1624 | | |
1617 | | - | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
1618 | 1630 | | |
1619 | 1631 | | |
1620 | 1632 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1019 | 1019 | | |
1020 | 1020 | | |
1021 | 1021 | | |
1022 | | - | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
1023 | 1025 | | |
1024 | 1026 | | |
1025 | 1027 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6174 | 6174 | | |
6175 | 6175 | | |
6176 | 6176 | | |
6177 | | - | |
6178 | | - | |
| 6177 | + | |
| 6178 | + | |
| 6179 | + | |
| 6180 | + | |
6179 | 6181 | | |
6180 | 6182 | | |
6181 | 6183 | | |
| |||
6201 | 6203 | | |
6202 | 6204 | | |
6203 | 6205 | | |
6204 | | - | |
| 6206 | + | |
| 6207 | + | |
6205 | 6208 | | |
6206 | 6209 | | |
6207 | 6210 | | |
| |||
6227 | 6230 | | |
6228 | 6231 | | |
6229 | 6232 | | |
6230 | | - | |
| 6233 | + | |
| 6234 | + | |
6231 | 6235 | | |
6232 | 6236 | | |
6233 | 6237 | | |
| |||
0 commit comments