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 MylesBorins committed Feb 18, 2023
1 parent f72f643 commit 1a808a4
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 @@ -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);

Expand Down

0 comments on commit 1a808a4

Please sign in to comment.