Commit graph

9 commits

Author SHA1 Message Date
Nathan Baulch
28c7394319
test: fix typos
PR-URL: https://github.com/nodejs/node/pull/55063
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2024-09-28 13:58:55 +00:00
Josh Lee
17fb18d3c2
src: fix slice of slice of file-backed Blob
The value for `new_end` was wrong: While the members `start_` and `end_`
refer to the entire length of the file, the parameters `start` and `end`
are relative to the current slice.

The new end would apparently have the current start_ subtracted from it,
and the length would possibly overflow when the FdEntry is asked for its
size or when get_reader is called, resulting in a subslice which extends
past the current slice, which shouldn't be possible. Add a CHECK if this
happens, rather than returning data outside the current slice.

There aren't any C++ tests for FdEntry, and on the javascript side there
isn't a way to ask the blob handle for its nominal size. That size could
be a large uint64, which gets converted to int64 to when FileHandle::new
is called, which interprets a negative length as unlimited.

Fixes: https://github.com/nodejs/node/issues/53908
PR-URL: https://github.com/nodejs/node/pull/53972
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2024-07-22 18:25:30 +00:00
Luigi Pinca
50d09bc5f6
test: deflake test-blob-file-backed
Avoid race conditions by using a different file for each subtest.

Fixes: https://github.com/nodejs/node/issues/51860
PR-URL: https://github.com/nodejs/node/pull/53920
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Michael Dawson <midawson@redhat.com>
2024-07-20 13:16:23 +00:00
Livia Medeiros
e738edce6a
test: use tmpdir.resolve()
Subsystems: blob, child_process, common, crypto, http, http2,
readline, repl, snapshot, trace_events

PR-URL: https://github.com/nodejs/node/pull/49127
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
2023-08-15 13:45:34 +00:00
Daeyeon Jeong
af9b48a2f1 src: fix creating an ArrayBuffer from a Blob created with openAsBlob
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/47691
Fixes: https://github.com/nodejs/node/issues/47683
Reviewed-By: James M Snell <jasnell@gmail.com>
2023-05-04 17:02:23 -07:00
James M Snell
595b2b3fd2 lib: disallow file-backed blob cloning
Disallow cloning of file-backed Blobs. If necessary, we can enable
this later but for now we disable it. The reason is because the
underlying FdEntry ends up bound to the Environment/Realm under
which is was created and transfering across worker threads ends up
failing.

Fixes: https://github.com/nodejs/node/issues/47334
PR-URL: https://github.com/nodejs/node/pull/47574
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2023-04-21 20:55:11 -07:00
Debadree Chatterjee
73645d6227
fs: invalidate blob created from empty file when written to
Fixes: https://github.com/nodejs/node/issues/47161
PR-URL: https://github.com/nodejs/node/pull/47199
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
2023-03-23 18:28:43 +00:00
James M Snell
71fb06fd64 src, lib: fixup lint and format issues for DataQueue/Blob
Co-authored-by: flakey5 <73616808+flakey5@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/45258
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-02-19 16:26:59 -08:00
James M Snell
950cec4c26 src: update Blob implementation to use DataQueue / File-backed Blobs
Co-authored-by: flakey5 <73616808+flakey5@users.noreply.github.com>
PR-URL: https://github.com/nodejs/node/pull/45258
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2023-02-19 16:26:58 -08:00