enable fuzzing with --enable-fuzzing

Only enable it if you know what you're doing
devs/zehortigoza/user-title
Boris Faure 7 years ago
parent d11ebd1247
commit 755a4c3f2f
  1. 19
      configure.ac
  2. 52
      src/bin/termpty.c

@ -67,6 +67,24 @@ requirements="\
EFL_ENABLE_EO_API_SUPPORT
EFL_ENABLE_BETA_API_SUPPORT
# check for fuzzing
want_fuzzing="fuzzing"
AC_ARG_ENABLE([fuzzing],
[AS_HELP_STRING([--enable-fuzzing],[Enable fuzzing on terminology. Binaries
are not suited for production. @<:@default=disabled@:>@])],
[
if test "x${enableval}" = "xyes" ; then
want_fuzzing="yes"
AC_DEFINE([ENABLE_FUZZING], [1], [Fuzzing enabled])
AC_SUBST([want_fuzzing])
else
want_fuzzing="no"
fi
],
[want_fuzzing="no"])
AM_CONDITIONAL([ENABLE_FUZZING], [test "${want_fuzzing}" = "yes"])
PKG_CHECK_MODULES([TERMINOLOGY], [${requirements}])
PKG_CHECK_MODULES([ELDBUS],
@ -169,4 +187,5 @@ echo
echo "Features:"
echo " dbus................: $have_eldbus"
echo " gettext.............: $have_po"
echo " fuzzing.............: $want_fuzzing"
echo

@ -278,20 +278,19 @@ _cb_fd_read(void *data, Ecore_Fd_Handler *fd_handler)
if (ty->cb.change.func) ty->cb.change.func(ty->cb.change.data);
if (len <= 0)
{
if (42)
{
ty->exit_code = 0;
ty->pid = -1;
if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit);
ty->hand_exe_exit = NULL;
if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd);
ty->hand_fd = NULL;
ty->fd = -1;
ty->slavefd = -1;
if (ty->cb.exited.func)
ty->cb.exited.func(ty->cb.exited.data);
}
#ifdef ENABLE_FUZZING
ty->exit_code = 0;
ty->pid = -1;
if (ty->hand_exe_exit) ecore_event_handler_del(ty->hand_exe_exit);
ty->hand_exe_exit = NULL;
if (ty->hand_fd) ecore_main_fd_handler_del(ty->hand_fd);
ty->hand_fd = NULL;
ty->fd = -1;
ty->slavefd = -1;
if (ty->cb.exited.func)
ty->cb.exited.func(ty->cb.exited.data);
#endif
return ECORE_CALLBACK_CANCEL;
}
@ -350,18 +349,16 @@ termpty_new(const char *cmd, Eina_Bool login_shell, const char *cd,
ty->circular_offset = 0;
/* TODO: boris */
if (42)
{
ty->fd = STDIN_FILENO;
ty->hand_fd = ecore_main_fd_handler_add(ty->fd,
ECORE_FD_READ | ECORE_FD_ERROR,
_cb_fd_read, ty,
NULL, NULL);
_pty_size(ty);
termpty_save_register(ty);
return ty;
}
#ifdef ENABLE_FUZZING
ty->fd = STDIN_FILENO;
ty->hand_fd = ecore_main_fd_handler_add(ty->fd,
ECORE_FD_READ | ECORE_FD_ERROR,
_cb_fd_read, ty,
NULL, NULL);
_pty_size(ty);
termpty_save_register(ty);
return ty;
#endif
needs_shell = ((!cmd) ||
(strpbrk(cmd, " |&;<>()$`\\\"'*?#") != NULL));
@ -911,8 +908,9 @@ termpty_write(Termpty *ty, const char *input, int len)
{
int fd = ty->fd;
/* TODO: boris */
#ifdef ENABLE_FUZZING
fd = STDOUT_FILENO;
#endif
if (fd < 0) return;
if (write(fd, input, len) < 0)
ERR(_("Could not write to file descriptor %d: %s"),

Loading…
Cancel
Save