[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #57195] cell (1e24, 1) does not produce immedi
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #57195] cell (1e24, 1) does not produce immediate error |
Date: |
Thu, 19 Dec 2019 12:15:56 -0500 (EST) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Gecko/20100101 Firefox/72.0 |
Follow-up Comment #6, bug #57195 (project octave):
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:
https://github.com/google/sanitizers/issues/740
I'm also no longer sure if this really is the same bug.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?57195>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/