diff --git a/lib/std/io/stream/bytebuffer.c3 b/lib/std/io/stream/bytebuffer.c3 index e550befdf..a81d886e5 100644 --- a/lib/std/io/stream/bytebuffer.c3 +++ b/lib/std/io/stream/bytebuffer.c3 @@ -130,7 +130,7 @@ fn usz? ByteBuffer.available(&self) @inline @dynamic fn void ByteBuffer.grow(&self, usz n) { - n = math::next_power_of_2(n); + n = math::next_power_of_2(self.bytes.len + n); char* p = allocator::realloc(self.allocator, self.bytes, n); self.bytes = p[:n]; } diff --git a/releasenotes.md b/releasenotes.md index 41898e94d..02758786d 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -9,6 +9,7 @@ - Regression with npot vector in struct triggering an assert #2219. - Casting bitstruct to wider base type should be single step #2616. - Optional does not play well with bit ops #2618. +- `Bytebuffer.grow` was broken #2622. ### Stdlib changes