| author | |
| committer | |
| log | 3ea015db968644c3f4e88fff59b9741b4903d478 |
| tree | 4afe864313c3eb2f7b30395897238d773d33f8fe |
| parent | 23fff3442de38877c556f3cda19f3cccef255f7a |
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.1 files changed, 1 insertions(+), 1 deletions(-)
lib/std/Io/Reader.zig+1-1| ... | ... | @@ -426,7 +426,7 @@ pub fn readVec(r: *Reader, data: [][]u8) Error!usize { |
| 426 | 426 | /// Writes to `Reader.buffer` or `data`, whichever has larger capacity. |
| 427 | 427 | pub fn defaultReadVec(r: *Reader, data: [][]u8) Error!usize { |
| 428 | 428 | const first = data[0]; |
| 429 | if (r.seek == r.end and first.len >= r.buffer.len) { | |
| 429 | if (first.len >= r.buffer.len - r.end) { | |
| 430 | 430 | var writer: Writer = .{ |
| 431 | 431 | .buffer = first, |
| 432 | 432 | .end = 0, |