Repository navigation
Commit 98f010e
authored
Reject ext32 length 0xffffffff in the C unpacker (#761)
The trail length of an ext value includes the typecode byte, so an ext32
length of `0xffffffff` wrapped to zero after `+ 1` in 32-bit arithmetic.
- `Unpacker.skip()` treated the 5-byte ext32 header as a complete object
and parsed the remaining bytes as the next object.
- `unpack()` / `unpackb()` were already rejected by the `max_ext_len`
check, but with a confusing `0 exceeds max_ext_len(...)` message.
This PR raises `ValueError` before adding the typecode byte. The pure
Python implementation is not affected.
Reported by Oz Kaiser (@tatikoma).1 parent 0258167 commit 98f010e
2 files changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
232 | 232 | | |
233 | 233 | | |
234 | 234 | | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
239 | 244 | | |
240 | 245 | | |
241 | 246 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
191 | 191 | | |
192 | 192 | | |
193 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
194 | 203 | | |
195 | 204 | | |
196 | 205 | | |
| |||
0 commit comments