Skip to content

Commit

Permalink
src: check return value of ftell()
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tniessen authored and danielleadams committed Apr 3, 2023
1 parent b3b3b33 commit bc9a577
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/node_snapshotable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,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);

Expand Down

0 comments on commit bc9a577

Please sign in to comment.