bugGNU Octave - Bugs: bug #52067, dconv2.f out of bound

 
 

bug #52067: dconv2.f out of bound

Submitter:  Dmitri A. Sergatskov <dasergatskov>
Submitted:  Wed 20 Sep 2017 05:54:53 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 23 Sep 2017 03:14:05 AM UTC, comment #4: 

Thanks. "make check" now passes when octave compiled
with -fbounds-check

(as of 80906ac05e7d tip @)

Dmitri.
--


Dmitri A. Sergatskov <dasergatskov>
Fri 22 Sep 2017 08:56:06 PM UTC, comment #3: 

The problem is that the "valid" shape can result in empty matrices.  However, the Fortran code was never set up to handle such an input.  It assumes that trivial cases like that have been filtered out.  I added a test in oct-convn.cc on whether the result matrix dimensions make it empty, and if it is then it short-circuits and returns from the function rather than passing the A and B matrices down to Fortran.  See http://hg.savannah.gnu.org/hgweb/octave/rev/88a593fa1388.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Fri 22 Sep 2017 06:35:37 PM UTC, comment #2: 

Checking through the tests in conv2.cc, the first one that causes the out-of-bounds access is one that uses the 'valid' shape.


### Test shapes
%!shared A, B, C
%! A = rand (3, 4);
%! B = rand (4);
%! C = conv2 (A, B);
#%!assert (conv2 (A,B, "full"), C)
#%!assert (conv2 (A,B, "same"), C(3:5,3:6))
%!assert (conv2 (A,B, "valid"), zeros (0, 1))


Bug #34893 might be relevant.  Or possibly bug #39314.

Rik <rik5>
Group administrator
Wed 20 Sep 2017 04:08:18 PM UTC, comment #1: 

I guess I'm not surprised.  I hate the convolution function.  It is coded in a tricky way and has caused multiple bug reports over the long history that I've been dealing with it.

Rik <rik5>
Group administrator
Wed 20 Sep 2017 05:54:53 AM UTC, original submission:  

I re-compiled octave with FFLAGS=-fbounds-check and the first
test that fails is:


octave:1> test libinterp/corefcn/conv2.cc-tst verbose
>>>>> /home/dima/src/octave/gcc_fbounds/libinterp/corefcn/conv2.cc-tst
***** test
 c = [0,1,2,3;1,8,12,12;4,20,24,21;7,22,25,18];
 assert (conv2 ([0,1;1,2], [1,2,3;4,5,6;7,8,9]), c);
***** test
 c = single ([0,1,2,3;1,8,12,12;4,20,24,21;7,22,25,18]);
 assert (conv2 (single ([0,1;1,2]), single ([1,2,3;4,5,6;7,8,9])), c);
***** test
 c = [1,4,4;5,18,16;14,48,40;19,62,48;15,48,36];
 assert (conv2 (1:3, 1:2, [1,2;3,4;5,6]), c);
***** assert (conv2 (1:3, 1:2, [1,2;3,4;5,6], "full"),
        conv2 (1:3, 1:2, [1,2;3,4;5,6]));
***** shared A, B, C
 A = rand (3, 4);
 B = rand (4);
 C = conv2 (A, B);
***** assert (conv2 (A,B, "full"), C)
***** assert (conv2 (A,B, "same"), C(3:5,3:6))
***** assert (conv2 (A,B, "valid"), zeros (0, 1))
At line 73 of file ../liboctave/external/blas-xtra/dconv2.f
Fortran runtime error: Index '4' of dimension 1 of array 'a' above upper bound of 3


Dmitri.
--

Dmitri A. Sergatskov <dasergatskov>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-22 rik5 StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code