diff options
author | 2023-07-30 16:18:13 +0800 | |
---|---|---|
committer | 2023-07-30 01:18:13 -0700 | |
commit | 413fd281208f24a532c47249dec1bfc3aef2bf37 (patch) | |
tree | 824f840e3b1cf637b8a632fac7b1ff04fca1afb9 /src | |
parent | 40a9ba63409694443058f558df2e480a8f16ff54 (diff) | |
download | bun-413fd281208f24a532c47249dec1bfc3aef2bf37.tar.gz bun-413fd281208f24a532c47249dec1bfc3aef2bf37.tar.zst bun-413fd281208f24a532c47249dec1bfc3aef2bf37.zip |
Fix coredump when reading an empty file(`node:stream:createReadStream`) (#3882)
* Fix coredump when reading an empty file.
Close: #3607
* It seems that the fd is closed when `auto_close` is true.
Diffstat (limited to 'src')
-rw-r--r-- | src/bun.js/webcore/streams.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/bun.js/webcore/streams.zig b/src/bun.js/webcore/streams.zig index 5dc4ea830..f2c5914ef 100644 --- a/src/bun.js/webcore/streams.zig +++ b/src/bun.js/webcore/streams.zig @@ -4433,6 +4433,10 @@ pub const FileReader = struct { var readable_file = File{ .loop = this.globalThis().bunVM().eventLoop() }; const result = readable_file.start(&blob.data.file); + if (result == .empty) { + this.lazy_readable = .{ .empty = {} }; + return result; + } if (result != .ready) { return result; } |