Commit c2b1826
committed
Harden IDManifest parsing against illegal shift and string prefix OOB
`readVariableLengthInteger()` must not apply `(byte & 127) << shift`
when `shift >= 64`; that is undefined behavior for `uint64_t` and
could yield corrupted lengths for string list parsing. Reject
encodings that exceed representable shifts.
When decoding compressed string lists, the common-prefix length is
encoded with one or two leading bytes depending on whether the
previous string exceeded 255 characters. Require each string to be at
least that many bytes before reading those prefix bytes, avoiding
out-of-bounds indexing on undersized entries.
Made with Cursor
Signed-off-by: Cary Phillips <cary@ilm.com>1 parent 1bd1988 commit c2b1826
1 file changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
118 | 125 | | |
119 | 126 | | |
120 | 127 | | |
| |||
337 | 344 | | |
338 | 345 | | |
339 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
340 | 354 | | |
341 | 355 | | |
342 | 356 | | |
| |||
0 commit comments