Commit 2df4e3a
fix(zstd): bound frame sizes and overflow-check total
decode summed untrusted per-frame uncompressed_size into a long with no
validation, then arena.allocate'd it; a crafted metadata could wrap the total
to a small positive (under-allocation) or claim a huge size (allocation DoS).
The (int) narrowing of uncompressed_size at the asSlice call site could also
go negative/truncated, throwing a raw IndexOutOfBoundsException instead of a
VortexException. Validate each frame via IoBounds.toIntSize and accumulate
with Math.addExact, surfacing overflow as VortexException.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 1d8ddeb commit 2df4e3a
1 file changed
Lines changed: 13 additions & 2 deletions
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
66 | | - | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
67 | 78 | | |
68 | 79 | | |
69 | 80 | | |
| |||
163 | 174 | | |
164 | 175 | | |
165 | 176 | | |
166 | | - | |
| 177 | + | |
167 | 178 | | |
168 | 179 | | |
169 | 180 | | |
| |||
0 commit comments