[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54419] Failure in fread() index causes multip
From: |
Dan Sebald |
Subject: |
[Octave-bug-tracker] [bug #54419] Failure in fread() index causes multiple error statements from get_size() try-catch |
Date: |
Wed, 1 Aug 2018 12:14:33 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0 |
URL:
<http://savannah.gnu.org/bugs/?54419>
Summary: Failure in fread() index causes multiple error
statements from get_size() try-catch
Project: GNU Octave
Submitted by: sebald
Submitted on: Wed 01 Aug 2018 04:14:32 PM UTC
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: Unexpected Error
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux
_______________________________________________________
Details:
For changeset: 25709:02fbbde15308, try the following
octave:1> fn = "ramp10by11.dat";
octave:2> fid = fopen(fn, "w+");
octave:3> fwrite (fid, ones(10,1)*[1:11], "single");
octave:4> frewind (fid);
octave:5> x = fread (fid, [-10, -11], "single");
error: fread: negative value invalid as size specification
error: value on right hand side of assignment is undefined
Inside get_size() of file oct-stream.cc is the following test that is throwing
the error on the negative index:
if (d < 0.0)
::error ("%s: negative value invalid as size specification",
who.c_str ());
Normally that ::error() variant is supposed to send control directly back to
the command line with error. However, it looks as though the point where
get_size() is called is within a try-catch block:
octave_value
stream::read (const Array<double>& size, octave_idx_type block_size,
oct_data_conv::data_type input_type,
oct_data_conv::data_type output_type,
octave_idx_type skip, mach_info::float_format ffmt,
octave_idx_type& count)
{
octave_value retval;
if (! stream_ok ())
return retval;
[snip]
try
{
get_size (size, nr, nc, one_elt_size_spec, "fread");
}
catch (const execution_exception&)
{
invalid_operation ("fread", "reading");
return retval;
}
As a result, the ::error() within get_size() doesn't act as expected, and a
second error message appears.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54419>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54419] Failure in fread() index causes multiple error statements from get_size() try-catch,
Dan Sebald <=