Skip to content

Missing return statements in file default_launcher.hpp cause an 'illegal instruction' #527

@bertwim

Description

@bertwim

In boost/process/v2/posix/default_launcher.hpp there is a template function invoke_on_success defined as

template<typename Launcher, typename Init>
inline auto invoke_on_success(Launcher & launcher, const filesystem::path &executable,
                              const char * const * (&cmd_line),
                              Init && init, derived && )
-> decltype(init.on_success(launcher, executable, cmd_line))
{
      init.on_success(launcher, executable, cmd_line);
}

This function is supposed to have a return value, but a return statement is missing. This causes (on my installation, using recent versions of both g++ and clang++) an 'illegal instruction' followed by an inevitable crash.

Adding a return statement solved the problem:

template<typename Launcher, typename Init>
inline auto invoke_on_success(Launcher & launcher, const filesystem::path &executable,
                              const char * const * (&cmd_line),
                              Init && init, derived && )
-> decltype(init.on_success(launcher, executable, cmd_line))
{
      return init.on_success(launcher, executable, cmd_line);
}

The same problem occurs (in the same file default_launcher.hpp) with the routines
invoke_on_error, invoke_on_fork_error and invoke_on_exec_error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions