octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #52567] invoking octave with conflicting argum


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #52567] invoking octave with conflicting arguments dumps core
Date: Fri, 1 Dec 2017 01:42:30 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #5, bug #52567 (project octave):

OK, I found the function in the code (error.cc).

Those remaining two uses of warning will surely fail if the two others fail. 
They are called immediately at the start of main.

Out of curiosity, I looked at the warning() routine.  It's pretty standard
code, using variable argument list routines, up until calling this routine:


static void
warning_1 (const char *id, const char *fmt, va_list args)
{
  int warn_opt = warning_enabled (id);

  if (warn_opt == 2)
    {
      // Handle this warning as an error.

      error_1 (std::cerr, "error", id, fmt, args);
    }
  else if (warn_opt == 1)
    {
      bool fmt_suppresses_backtrace = false;
      size_t fmt_len = (fmt ? strlen (fmt) : 0);
      fmt_suppresses_backtrace = (fmt_len > 0 && fmt[fmt_len-1] == '\n');

      if (fmt_suppresses_backtrace && fmt_len > 1)
        {
          // Strip newline before issuing warning
          std::string tmp_fmt (fmt, fmt_len - 1);
          vwarning ("warning", id, tmp_fmt.c_str (), args);
        }
      else
        vwarning ("warning", id, fmt, args);

      octave::call_stack& cs = octave::__get_call_stack__ ("warning_1");

      bool in_user_code = cs.caller_user_code () != nullptr;

      if (! fmt_suppresses_backtrace && in_user_code
          && Vbacktrace_on_warning
          && ! discard_warning_messages)
        pr_where (std::cerr, "warning");

      if ((octave::application::interactive ()
           || octave::application::forced_interactive ())
          && Vdebug_on_warning && in_user_code && bp_table::debug_on_warn
(id))
        {
          octave::unwind_protect frame;
          frame.protect_var (Vdebug_on_warning);
          Vdebug_on_warning = false;

          octave::tree_evaluator::debug_mode = true;

          octave::tree_evaluator::current_frame = cs.current_frame ();

          do_keyboard (octave_value_list ());
        }
    }
}


>From about


       octave::call_stack& cs = octave::__get_call_stack__ ("warning_1");


onward the code becomes dodgy as to whether stack, protect, current frame and
do_keyboard are using things all properly initialized by this point.

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52567>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]