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: nodejs#46463
  • Loading branch information
tniessen committed Feb 4, 2023
1 parent 6bbc2fb commit f60ad96
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 f60ad96

Please sign in to comment.