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

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

[Octave-bug-tracker] [bug #54405] octave_idx_type index integer overflow


From: Rik
Subject: [Octave-bug-tracker] [bug #54405] octave_idx_type index integer overflow math check doesn't work correctly
Date: Mon, 30 Jul 2018 00:50:19 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0

Follow-up Comment #4, bug #54405 (project octave):

You definitely don't want to define octave_idx_type as unsigned.  It has been
a signed quantity for a long time (maybe forever) and there is probably lots
of code that depends on that fact.

Note that error for octave_stream objects is not the same function as error in
the rest of the octave.  In the rest of Octave the function error comes from
libinterp/corefcn/error.[h|cc].  This prints an error message to stderr and
immediately returns, through exceptions, to the command prompt.

For Octave streams see libinterp/corefcn/oct-stream.[h|cc].  Here, error sets
the error bit on the stream and puts an error message into the last error
message buffer.  Here is the message I wrote in oct-stream.cc because it is
tricky.


  // Programming Note: There are two very different error functions used
  // in the stream code.  When invoked with "error (...)" the member
  // function from octave::stream or octave::base_stream is called.  This
  // function sets the error state on the stream AND returns control to
  // the caller.  The caller must then return a value at the end of the
  // function.  When invoked with "::error (...)" the exception-based
  // error function from error.h is used.  This function will throw an
  // exception and not return control to the caller.  BE CAREFUL and
  // invoke the correct error function!





    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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