bugGNU Octave - Bugs: bug #57195, cell (1e24,1) does not produce...


bug #57195: cell (1e24,1) does not produce immediate error

Submitted by:  A.R. Burgers <arb>
Submitted on:  Sat 09 Nov 2019 03:25:31 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Regression
Status:  Confirmed Assigned to:  None
Originator Name:  Open/Closed:  Open
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Thu 19 Dec 2019 05:15:55 PM UTC, comment #6: 

I originally noticed this in bug #57438.

Running the test suite with the address sanitizer passes with the following change:

diff -r d053ff4321b5 liboctave/array/Array.h
--- a/liboctave/array/Array.h        Thu Dec 19 17:42:46 2019 +0100
+++ b/liboctave/array/Array.h        Thu Dec 19 18:10:45 2019 +0100
@@ -155,11 +155,22 @@
     ArrayRep (void) : data (new T [0]), len (0), count (1) { }

     explicit ArrayRep (octave_idx_type n)
-      : data (new T [n]), len (n), count (1) { }
+      : data (new (std::nothrow) T [n]), len (n), count (1)
+      {
+        if (! data)
+          (*current_liboctave_error_handler)
+            ("Out of memory while allocating array with %"
+             OCTAVE_IDX_TYPE_FORMAT " elements.", n);
+      }

     explicit ArrayRep (octave_idx_type n, const T& val)
-      : data (new T [n]), len (n), count (1)
+      : data (new (std::nothrow) T [n]), len (n), count (1)
+        if (! data)
+          (*current_liboctave_error_handler)
+            ("Out of memory while allocating array with %"
+             OCTAVE_IDX_TYPE_FORMAT " elements.", n);
       std::fill_n (data, n, val);

Not sure why that would be any better though.

See also this bug against the sanitizer:

I'm also no longer sure if this really is the same bug.

Markus Mützel <mmuetzel>
Project Member
Thu 19 Dec 2019 04:58:09 PM UTC, comment #5: 

This is a much bigger issue than it appears.  I am going to have to revert a previous changeset and think up a new way of dealing with corner case octave_idx_types.

Rik <rik5>
Project Administrator
Wed 18 Dec 2019 12:45:02 PM UTC, comment #4: 

Should xidx_type_value (and also idx_type_value?) error if the value is larger than Octave's index type?

Markus Mützel <mmuetzel>
Project Member
Sat 09 Nov 2019 07:32:34 PM UTC, comment #3: 

Okay, I know the problem but will check on Octave Maintainer's list about the correct approach to a solution.

Rik <rik5>
Project Administrator
Sat 09 Nov 2019 04:01:22 PM UTC, comment #2: 

Indeed, I built with --disable-64, both dev and stable.

A.R. Burgers <arb>
Sat 09 Nov 2019 03:50:17 PM UTC, comment #1: 

I get an immediate error with the dev version which makes sens because 1e24 is well above the size of Octave's index type even with 64-bit integers.

Are you by chance configuring with --disable-64 and using 32-bit integers for octave_idx_type?  I can reproduce the problem on a build where that is the case.

Rik <rik5>
Project Administrator
Sat 09 Nov 2019 03:25:31 PM UTC, original submission:  

cell(1.e24,1) is a test in ov-cell.cc-tst

on octave-5.1.1

octave:1> version
ans = 5.1.1
octave:2> cell(1.e24,1)
error: out of memory or dimension too large for Octave's index type

On dev memory consumption grows quickly on executing cell(1.24,1), as observed in "top" program or other process monitor. The command is difficult to interrupt with <Ctrl-C>

This is detected as a FAIL in ov-cell.cc-tst on dev.

A.R. Burgers <arb>


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

Attach Files:

No files currently attached


Depends on the following items: None found

   bug dependencies.


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

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-12-18 mmuetzel Dependencies- => bugs #57438 is dependent
    2019-11-09 rik5 StatusNone => Confirmed
        Summarycell(1.e24,1) does not produce error => cell (1e24,1) does not produce immediate error

    Back to the top

    Powered by Savane 3.7