Repository navigation
Commit 1ce3555
Do not share the output buffer in Zlib::Deflate#initialize_copy
The copy shared the buffer string with the original, and its next_out
still pointed into the original's buffer.
z1 = Zlib::Deflate.new
z1 << Random.bytes(50_000)
z2 = z1.dup
z2 << "foo"
#=> can't set length of shared string (RuntimeError)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>1 parent ccb2d02 commit 1ce3555
2 files changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1746 | 1746 | | |
1747 | 1747 | | |
1748 | 1748 | | |
1749 | | - | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
1750 | 1756 | | |
1751 | 1757 | | |
1752 | 1758 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
42 | 53 | | |
43 | 54 | | |
44 | 55 | | |
| |||
0 commit comments