bugGNU Octave - Bugs: bug #46246, Segfault when reading image with...

 
 

bug #46246: Segfault when reading image with imread

Submitter:  John <jcoppens>
Submitted:  Mon 19 Oct 2015 03:48:52 AM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Works For Me Assigned to:  None
Originator Name:  John Open/Closed:  * Closed
Release:  * 4.0.0 Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 22 Feb 2016 12:08:25 AM UTC, comment #11: 

This report has been idle for several months. Have you made any progress debugging your build of Octave? I don't think any of the developers are able to reproduce this, it seems like some problem with your GraphicsMagick or other system libraries.

Mike Miller <mtmiller>
Group Member
Tue 20 Oct 2015 02:02:35 PM UTC, comment #10: 

Pantxo:

gm display <image>                            works fine.
gm convert -scale 400 image1.jpg image2.jpg   works too

Inside octave, using the same image1.jpg as above, on doing 'a = imread('image1.jpg'), I get the error:

warning: your version of GraphicsMagick limits images to 16 bits per pixel
warning: called from
    imformats>default_formats at line 256 column 11
    imformats at line 79 column 3
    imageIO at line 106 column 11
    imread at line 106 column 30
octave-gui: magick/pixel_cache.c:2886: ModifyCache: Assertion `image->cache != (Cache) ((void *)0)' failed.
panic: Aborted -- stopping myself...
attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete
Aborted

Thanks for the other information - I just started to use GM because of the requirements of Octave.

John <jcoppens>
Tue 20 Oct 2015 07:14:10 AM UTC, comment #9: 


>>While checking the strace output, I noticed that, even though I used octave with --no-gui, all GUI-related libraries are still loaded. Is this normal?


Yes, if you want pure cli and no Qt libs, try "-cli" option. The "--no-gui" option doesn't load the main GUI widgets but is still able to use Qt toolkit for graphics.

>> pkg load signal


Signal package should have nothing to do with this bug, "imread" is a core function.

After compiling GraphicsMagick did you try to use simple "gm" command line utility (see e.g. this old bug report [1])? Or did you run their test suite (if they do have one)? This is just to make sure GM is working properly on its own.

[1] http://permalink.gmane.org/gmane.comp.video.graphicsmagick.bugs/99

Pantxo Diribarne <pantxo>
Group Member
Tue 20 Oct 2015 04:12:09 AM UTC, comment #8: 

I'm recompiling a version without using the SlackBuild script - from the config.log I can see the AMD libraries are not included.

While checking the strace output, I noticed that, even though I used octave with --no-gui, all GUI-related libraries are still loaded. Is this normal?

Finished compiling. On executing

pkg load signal
a = imread('image.png')

I get:

warning: called from
    imformats>default_formats at line 256 column 11
    imformats at line 79 column 3
    imageIO at line 106 column 11
    imread at line 106 column 30
octave-gui: magick/pixel_cache.c:2886: ModifyCache: Assertion `image->cache != (Cache) ((void *)0)' failed.

Program received signal SIGABRT, Aborted.

(Attached backtrace)


(file #35239)

John <jcoppens>
Tue 20 Oct 2015 01:35:20 AM UTC, comment #7: 

I hope I didn't give the impression that I'm an expert on all this.

I found (using strace on octave) that it libacml gets pulled in on line 875 or so. So it doesn't seem to depend on the environment. This is way after the default dependencies from Octave are loaded. I looked over the SlackBuild script, and found that there, some links are made to the amd files. I'm attaching the script. I've no idea how to avoid loading acml.

Glad to do any other tests...

(file #35238)

John <jcoppens>
Mon 19 Oct 2015 11:59:33 PM UTC, comment #6: 

Thanks for the info. What about the ACML library? Did you intentionally install that or configure Octave to use it, or is your environment loading it when Octave is being run? Can you try Octave without it and see if the segfault disappears?

To be clear I'm talking about the library /usr/lib64/libacml_mp.so that shows up in your gdb backtrace.

Mike Miller <mtmiller>
Group Member
Mon 19 Oct 2015 11:32:14 PM UTC, comment #5: 

Sorry about the delay.

I compiled GraphicsMagick with the following parameters:

./configure --prefix=/usr
            --libdir=/usr/lib64
            --with-quantum-depth=16
            --enable-shared
            --disable-static
            --with-magick-plus-plus=yes

I then (re-)compiled Octave with the SlackBuild script.

Finally, I installed the Signal library (1.3.2) using the pkg install command.

John <jcoppens>
Mon 19 Oct 2015 03:55:31 PM UTC, comment #4: 

The backtrace looks like the error is occurring in the AMD ACML library, in a function called GetCacheInfo(). Moreover, I see that GraphicsMagick has a function called GetCacheInfo(Cache*).

I suspect some conflict between the ACML library and the GraphicsMagick library. Would be helpful to see if this crash only occurs when ACML is loaded (using LD_PRELOAD?)

@Pantxo: actually recently distributions have started building GM --with-quantum-depth=16 (RHEL 7, Fedora, Debian testing, Ubuntu 15.04).

Mike Miller <mtmiller>
Group Member
Mon 19 Oct 2015 01:25:52 PM UTC, comment #3: 

end of comment #2 should read
"... which is generally not the default for GraphicsMagick on linux distros."

Pantxo Diribarne <pantxo>
Group Member
Mon 19 Oct 2015 07:49:29 AM UTC, comment #2: 

Hi,

Can you provide relevant informations on the way you installed Octave 4.0 and GraphicsMagic (responsible for loading image data from file). I see that you have quantum-depth=16 (instead of 8) which is generally the default for GraphicsMagick on linux distros.

Pantxo Diribarne <pantxo>
Group Member
Mon 19 Oct 2015 04:07:55 AM UTC, comment #1: 

The signal library installed is version 1.3.2

John <jcoppens>
Mon 19 Oct 2015 03:48:52 AM UTC, original submission:  

When trying to read an image I get the following error:

warning: your version of GraphicsMagick limits images to 16 bits per pixel
panic: Segmentation fault -- stopping myself...
attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete
octave exited with signal 11


I used the following code:

s1 = double(imread('st.png'));

I tried:

- Same code with st.png = converted from the original tif.
- I though the 'double' conversion was the problem, so I removed that too.
- I also tried another image altogether.

Attached the gdb backtrace

https://savannah.gnu.org/bugs/?41699 could be related if the underlying structures are of the type used.

https://savannah.gnu.org/bugs/?42488 is similar but I have no 'clear all' calls (and I'm using Linux)

Note that this is dissimilar to most bug reports, as this happens immediately - not on exit.

John <jcoppens>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #35239:  octave_abort added by jcoppens (9KiB - application/octet-stream)
file #35238:  octave.SlackBuild added by jcoppens (4KiB - application/octet-stream)
file #35224:  octave segfault added by jcoppens (11KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by pantxo (Posted a comment)
  • -email is unavailable- added by jcoppens (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-03-21 mtmiller StatusNeed Info Works For Me
        Open/ClosedOpen Closed
    2015-10-20 jcoppens Attached File- Added octave_abort, #35239
    2015-10-20 jcoppens Attached File- Added octave.SlackBuild, #35238
    2015-10-19 mtmiller StatusNone Need Info
    2015-10-19 mtmiller StatusNeed Info None
    2015-10-19 pantxo StatusNone Need Info
    2015-10-19 rik5 Carbon-CopyRemoved 72865 -
    2015-10-19 rik5 SummarySegfaukt when reading image with imread Segfault when reading image with imread
    2015-10-19 jcoppens Attached File- Added octave segfault, #35224

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code