Commit a5f4aa0
fix: make ZstdSkippableContent defensively copy its bytes (#21)
The record stored the caller's array and handed it back from content()
uncopied, so a "value" object could be mutated through the input array
or the accessor result. Clone in the compact constructor and in the
content() accessor, matching ZstdDictionary's copy-in/copy-out. Add a
test that mutating the source array and the accessor result leaves the
record untouched.
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent c9929b9 commit a5f4aa0
2 files changed
Lines changed: 28 additions & 0 deletions
File tree
- zstd/src
- main/java/io/github/dfa1/zstd
- test/java/io/github/dfa1/zstd
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
12 | 26 | | |
13 | 27 | | |
14 | 28 | | |
| |||
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
145 | 159 | | |
146 | 160 | | |
147 | 161 | | |
| |||
0 commit comments