Repository navigation
Commit 8160453
Passing an iterator to `bytearray.__init__` didn't take into account
that iterating that iterator could modify the bytearray position and
`ob_start`. When that happened the iterator would write beyond the end
of the allocation.
Update the "enough space" check to account for `ob_start`. The
assignment always included it. Add an assert after append that the
offsets line up as expected.
(cherry picked from commit 25181ce)
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 476b725 commit 8160453
3 files changed
Lines changed: 31 additions & 4 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/Security
- Objects
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2027 | 2027 | | |
2028 | 2028 | | |
2029 | 2029 | | |
| 2030 | + | |
| 2031 | + | |
| 2032 | + | |
| 2033 | + | |
| 2034 | + | |
| 2035 | + | |
| 2036 | + | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
2030 | 2046 | | |
2031 | 2047 | | |
2032 | 2048 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1158 | 1158 | | |
1159 | 1159 | | |
1160 | 1160 | | |
1161 | | - | |
| 1161 | + | |
1162 | 1162 | | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
1163 | 1166 | | |
1164 | | - | |
1165 | | - | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
1166 | 1172 | | |
1167 | 1173 | | |
1168 | 1174 | | |
1169 | | - | |
| 1175 | + | |
1170 | 1176 | | |
| 1177 | + | |
1171 | 1178 | | |
| 1179 | + | |
| 1180 | + | |
1172 | 1181 | | |
1173 | 1182 | | |
1174 | 1183 | | |
| |||
0 commit comments