Skip to content

Commit

Permalink
stream_file: don't allow to open standard streams during fuzzing
Browse files Browse the repository at this point in the history
To avoid all sorts of I/O loops.
  • Loading branch information
kasper93 committed Dec 29, 2024
1 parent 83bb498 commit 1dd0e49
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions stream/stream_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,10 @@ static int open_f(stream_t *stream, const struct stream_open_args *args)
MP_ERR(stream, "Invalid FD: %d\n", p->fd);
return STREAM_ERROR;
}
#endif
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
if (p->fd == STDIN_FILENO || p->fd == STDOUT_FILENO || p->fd == STDERR_FILENO)
return STREAM_ERROR;
#endif
if (is_fdclose)
p->close = true;
Expand Down

0 comments on commit 1dd0e49

Please # to comment.