mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
Io.Reader fix defaultReadVec
Running tar.pipeToFileSystem compressed_mingw_includes.tar file from #24732 finishes in infinite loop calling defaultReadVec with: r.seek = 1024 r.end = 1024 r.buffer.len = 1024 first.len = 512 that combination calls vtable.stream with 0 capacity writer and loops forever. Comment is to use whichever has larger capacity, and this fix reflects that.
This commit is contained in:
parent
23fff3442d
commit
3ea015db96
1 changed files with 1 additions and 1 deletions
|
|
@ -426,7 +426,7 @@ pub fn readVec(r: *Reader, data: [][]u8) Error!usize {
|
|||
/// Writes to `Reader.buffer` or `data`, whichever has larger capacity.
|
||||
pub fn defaultReadVec(r: *Reader, data: [][]u8) Error!usize {
|
||||
const first = data[0];
|
||||
if (r.seek == r.end and first.len >= r.buffer.len) {
|
||||
if (first.len >= r.buffer.len - r.end) {
|
||||
var writer: Writer = .{
|
||||
.buffer = first,
|
||||
.end = 0,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue