Skip to content

Commit bc9a577

Browse files
tniessendanielleadams
authored andcommitted
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: #46463 PR-URL: #46495 Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent b3b3b33 commit bc9a577

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/node_snapshotable.cc

+1
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,7 @@ bool SnapshotData::FromBlob(SnapshotData* out, FILE* in) {
867867
int err = fseek(in, 0, SEEK_END);
868868
CHECK_EQ(err, 0);
869869
size_t size = ftell(in);
870+
CHECK_NE(size, static_cast<size_t>(-1L));
870871
err = fseek(in, 0, SEEK_SET);
871872
CHECK_EQ(err, 0);
872873

0 commit comments

Comments
 (0)