summaryrefslogtreecommitdiff
path: root/src/node_snapshotable.cc
diff options
context:
space:
mode:
authorTobias Nießen <tniessen@tnie.de>2023-02-06 15:59:36 +0100
committerGitHub <noreply@github.com>2023-02-06 14:59:36 +0000
commit1e9ca451c19dc096fba342b33a02879d34fbab23 (patch)
tree1fd96a74b4d96483ac627928d5ec75f501b789ba /src/node_snapshotable.cc
parent8a4b1c9636ccb54f57f044209d76bfa71d90699f (diff)
downloadnode-new-1e9ca451c19dc096fba342b33a02879d34fbab23.tar.gz
src: check return value of ftell()
If ftell() returns -1L, abort instead of passing static_cast<size_t>(-1) to the vector allocator and fread(). Refs: https://github.com/nodejs/node/pull/46463 PR-URL: https://github.com/nodejs/node/pull/46495 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
Diffstat (limited to 'src/node_snapshotable.cc')
-rw-r--r--src/node_snapshotable.cc1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/node_snapshotable.cc b/src/node_snapshotable.cc
index aa66eb3312..f2fc879f52 100644
--- a/src/node_snapshotable.cc
+++ b/src/node_snapshotable.cc
@@ -877,6 +877,7 @@ bool SnapshotData::FromBlob(SnapshotData* out, FILE* in) {
int err = fseek(in, 0, SEEK_END);
CHECK_EQ(err, 0);
size_t size = ftell(in);
+ CHECK_NE(size, static_cast<size_t>(-1L));
err = fseek(in, 0, SEEK_SET);
CHECK_EQ(err, 0);