[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #47468] ones() is able to create array with nu
From: |
Carnë Draug |
Subject: |
[Octave-bug-tracker] [bug #47468] ones() is able to create array with number of elements above sizemax |
Date: |
Sat, 19 Mar 2016 19:04:25 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 Iceweasel/38.6.1 |
URL:
<http://savannah.gnu.org/bugs/?47468>
Summary: ones() is able to create array with number of
elements above sizemax
Project: GNU Octave
Submitted by: carandraug
Submitted on: Sat 19 Mar 2016 19:04:24 GMT
Category: Libraries
Severity: 3 - Normal
Priority: 5 - Normal
Item Group: None
Status: None
Assigned to: None
Originator Name:
Originator Email:
Open/Closed: Open
Discussion Lock: Any
Release: dev
Operating System: GNU/Linux
_______________________________________________________
Details:
The functions ones() is able to create an array with more elements than it
should.
The problem is probably on input check. It is able to create an array with one
element above sizemax (I will report a separate bug for the limit of sizemax
which is one below the numeric limit of int32).
octave> uint64 (numel (ones (1, sizemax ())))
ans = 2147483646
octave> uint64 (numel (ones (1, sizemax () +1)))
ans = 2147483647
octave> uint64 (numel (ones (1, sizemax () +10)))
ans = 2147483647
Interestingly, this only works when sizemax is the number of columns:
octave> uint64 (numel (ones (sizemax () +1, 1)))
error: out of memory or dimension too large for Octave's index type
octave> uint64 (numel (ones (1, 1, sizemax () +1)))
error: out of memory or dimension too large for Octave's index type
zeros () is more sensitive the other way and even fails when creating an array
with numel == sizemax:
octave> uint64 (numel (zeros (1, sizemax ())))
error: out of memory or dimension too large for Octave's index type
octave> uint64 (numel (zeros (sizemax (), 1)))
error: out of memory or dimension too large for Octave's index type
and even for less elements than sizemax():
octave> uint64 (numel (zeros (sizemax ()-1, 1)))
error: out of memory or dimension too large for Octave's index type
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47468>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #47468] ones() is able to create array with number of elements above sizemax,
Carnë Draug <=