octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #49699] Octave crashes when using fread to loa


From: anonymous
Subject: [Octave-bug-tracker] [bug #49699] Octave crashes when using fread to load more than 2 GB from a file
Date: Fri, 25 Nov 2016 09:43:36 +0000 (UTC)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?49699>

                 Summary: Octave crashes when using fread to load more than 2
GB from a file
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Fri 25 Nov 2016 09:43:34 AM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Crash
                  Status: None
             Assigned to: None
         Originator Name: David Rendon
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 4.2.0
        Operating System: Mac OS

    _______________________________________________________

Details:

Octave versions: 4.2.0-rc2 (Homebrew), 4.0.3 Mac OS X bundle
OS versions: OS X 10.11.6 El Capitan (Darwin 15.6.0)

Is reproducible:  Yes, always.

Steps to reproduce:

% TheFile is any file larger than 2 GB, e.g. a large CT scan in a NIfTI file.
fid = fopen (TheFile, 'r');
myVar = fread(fid, 536870913, 'float32');

At this point Octave consistently crashes, some times immediately while in
some cases it will display this error message for a few seconds:

Assertion failed: (input_buf_size >= 0), function read, file
libinterp/corefcn/oct-stream.cc, line 6535.
panic: Abort trap: 6 -- stopping myself...
attempting to save variables to 'octave-workspace'...

(The line number of course depends on the Octave version.)

Other statements that cause the crash:

myVar = fread(fid, 1073741825, '*int16');
myVar = fread(fid, 2147483649, '*char');

They all have in common that the number of bytes requested are more than
2^31.

Workaround: Preallocate myVar and read chunks of less than 2GB  from the file
into it.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49699>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]