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

 
 

bug #46246: Segfault when reading image with imread

Submitted by:  John <jcoppens>
Submitted on:  Mon 19 Oct 2015 03:48:52 AM UTC  
 
Category: Octave FunctionSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Segfault, Bus Error, etc.
Status: Works For MeAssigned to: None
Originator Name: JohnOpen/Closed: Closed
Release: 4.0.0Operating 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 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>
Project Administrator
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>
Project 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>
Project Administrator
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>
Project Administrator
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>
Project 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>
Project 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 File(s):
   
   
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
  • -unavailable- added by mtmiller (Posted a comment)
  • -unavailable- added by pantxo (Posted a comment)
  • -unavailable- added by jcoppens (Submitted the item)
  •  

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

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 10 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 21 Mar 2016 10:42:08 PM UTCmtmillerStatusNeed Info=>Works For Me
      Open/ClosedOpen=>Closed
    Tue 20 Oct 2015 04:12:09 AM UTCjcoppensAttached File-=>Added octave_abort, #35239
    Tue 20 Oct 2015 01:35:20 AM UTCjcoppensAttached File-=>Added octave.SlackBuild, #35238
    Mon 19 Oct 2015 03:55:51 PM UTCmtmillerStatusNone=>Need Info
    Mon 19 Oct 2015 03:55:31 PM UTCmtmillerStatusNeed Info=>None
    Mon 19 Oct 2015 03:52:49 PM UTCpantxoStatusNone=>Need Info
    Mon 19 Oct 2015 03:35:38 PM UTCrik5Carbon-CopyRemoved 72865=>-
    Mon 19 Oct 2015 03:35:25 PM UTCrik5SummarySegfaukt when reading image with imread=>Segfault when reading image with imread
    Mon 19 Oct 2015 03:48:52 AM UTCjcoppensAttached File-=>Added octave segfault, #35224

    Back to the top


    Powered by Savane 3.1-cleanup1