Commit 48672b2
authored
parser lyb BUGFIX integer overflow and OOM (#2513)
lyb_read_string: when str_len == UINT32_MAX, (str_len + 1) wraps to 0,
malloc(0) returns non-NULL, and the subsequent write to (*str)[UINT32_MAX]
causes a WRITE SEGV (memory corruption).
lyb_read_value: when lyb_size_bits == UINT32_MAX with VARIABLE_BYTES,
LYPLG_BITS2BYTES() produces ~4 GiB, causing calloc to attempt a 4 GiB
allocation which triggers OOM / DoS.
Both paths are reachable by supplying a malformed LYB input with
length field set to 0xFFFFFFFF.
Reported-by: Dominik Blain <dominik@qreativelab.io>, Cobalt AI1 parent ca68827 commit 48672b2
1 file changed
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
284 | 284 | | |
285 | 285 | | |
286 | 286 | | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
287 | 290 | | |
288 | 291 | | |
289 | 292 | | |
| |||
340 | 343 | | |
341 | 344 | | |
342 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
343 | 351 | | |
344 | 352 | | |
345 | 353 | | |
| |||
0 commit comments