bugGNU Octave - Bugs: bug #45372, crash on zoom using imshow with...

 
 

bug #45372: crash on zoom using imshow with uint8 data (also image and imagesc)

Submitter:  Hartmut <hardy>
Submitted:  Mon 22 Jun 2015 10:42:01 AM UTC
   
 
Category:  Plotting with OpenGL Severity:  4 - Important
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.0.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 09 Jun 2017 03:33:49 PM UTC, comment #9: 

Upgrade to the latest stable version of Octave, 4.2.1.

Rik <rik5>
Group administrator
Fri 09 Jun 2017 01:17:33 PM UTC, comment #8: 

Dear all, i'm sorry, but could kindly someone explain me hoe to resolve the problem?

In particular how have i to procede?
Install, which command do in the command line, etc... sorry, it's my forst time...
I've got OpenSuse.

Many thanks

Luca <bastia>
Mon 22 Jun 2015 08:01:09 PM UTC, comment #7: 

I am the one to blame :-), so I may try to explain the oddity.
As the octave_value class may store such types as function handles, I hadn't thought that it could feature array specific methods like rows/columns. Hence I first (blindly) turned the octave_value into an array type.

I pushed the fix here:
http://hg.savannah.gnu.org/hgweb/octave/rev/dc74b700cdec

Pantxo Diribarne <pantxo>
Group Member
Mon 22 Jun 2015 07:58:02 PM UTC, comment #6: 

For me this patch works fine as well. It eliminates the crashes with imshow, image and imagesc. (Tested only on Ubuntu 14.04)

Hartmut <hardy>
Mon 22 Jun 2015 07:35:56 PM UTC, comment #5: 

The patch works for me.  I don't know why the code was casting to a double matrix value just to get the number of rows.  Very odd.

The fix should definitely go on stable.

Rik <rik5>
Group administrator
Mon 22 Jun 2015 07:15:12 PM UTC, comment #4: 

BTW, the bug can be triggered just using a right click on the image which triggers the selection process (for eventual context menu execution).
However, when in zoom mode, I don't expect that the left mouse button triggers object selection as it is already used for drawing the zoom-box.

Pantxo Diribarne <pantxo>
Group Member
Mon 22 Jun 2015 07:03:52 PM UTC, comment #3: 

Hi,

I attached a patch that fixes the issue for me.


(file #34295)

Pantxo Diribarne <pantxo>
Group Member
Mon 22 Jun 2015 04:45:32 PM UTC, comment #2: 

Confirmed on dev.  Running with the debugger is not very informative.  See below.


(gdb) info threads
  Id   Target Id         Frame
  2    Thread 0x7fffdc8e9700 (LWP 19122) "lt-octave-gui" 0x00007ffff46146f3 in select ()
    at ../sysdeps/unix/syscall-template.S:82
* 1    Thread 0x7ffff7fa77c0 (LWP 19106) "lt-octave-gui" 0x00007ffff455e0d5 in __GI_raise (
    sig=<optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64

(gdb) bt
#0  0x00007ffff455e0d5 in __GI_raise (sig=<optimized out>)
    at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  0x00007ffff456183b in __GI_abort () at abort.c:91
#2  0x00007ffff4eb669d in __gnu_cxx::__verbose_terminate_handler() ()
   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3  0x00007ffff4eb4846 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4  0x00007ffff4eb4873 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5  0x00007ffff4eb49b6 in __cxa_rethrow () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff2eb816c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7  0x00007ffff2ebcf67 in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8  0x00007ffff7a2b597 in octave_start_gui (argc=10, argv=0x7fffffffca28, start_gui=false)
    at src/octave-gui.cc:199
#9  0x0000000000402dc0 in main (argc=10, argv=0x7fffffffca28) at main-gui.cc:43

(gdb) thread 2
[Switching to thread 2 (Thread 0x7fffdc8e9700 (LWP 19122))]
#0  0x00007ffff46146f3 in select () at ../sysdeps/unix/syscall-template.S:82
82      ../sysdeps/unix/syscall-template.S: No such file or directory.

(gdb) bt
#0  0x00007ffff46146f3 in select () at ../sysdeps/unix/syscall-template.S:82
#1  0x00007fffee716317 in ?? () from /lib/x86_64-linux-gnu/libreadline.so.6
#2  0x00007fffee716585 in rl_read_key () from /lib/x86_64-linux-gnu/libreadline.so.6
#3  0x00007fffee701251 in readline_internal_char () from /lib/x86_64-linux-gnu/libreadline.so.6
#4  0x00007fffee701795 in readline () from /lib/x86_64-linux-gnu/libreadline.so.6
#5  0x00007ffff5d2ebcc in octave_rl_readline (prompt=0x7fffd84c0898 ">> ")
    at util/oct-rl-edit.c:210
#6  0x00007ffff5cf0f91 in gnu_readline::do_readline (this=0x8025d0, prompt=...,
    eof=@0x7fffdc8e7fcf: false) at util/cmd-edit.cc:280
#7  0x00007ffff5cf2574 in command_editor::readline (prompt=..., eof=@0x7fffdc8e7fcf: false)
    at util/cmd-edit.cc:1084
#8  0x00007ffff702e878 in gnu_readline (s=..., eof=@0x7fffdc8e7fcf: false) at corefcn/input.cc:187
#9  0x00007ffff702ea26 in interactive_input (s=..., eof=@0x7fffdc8e7fcf: false)
    at corefcn/input.cc:215
#10 0x00007ffff702eb71 in octave_base_reader::octave_gets (this=0x7fffd81dced0,
    eof=@0x7fffdc8e7fcf: false) at corefcn/input.cc:255
#11 0x00007ffff70301a1 in octave_terminal_reader::get_input (this=0x7fffd81dced0,
    eof=@0x7fffdc8e7fcf: false) at corefcn/input.cc:639
#12 0x00007ffff6d6e8db in octave_input_reader::get_input (this=0x7fffd844da88,
    eof=@0x7fffdc8e7fcf: false) at corefcn/input.h:263
#13 0x00007ffff6d6e335 in octave_lexer::fill_flex_buffer (this=0x7fffd844d800,
    buf=0x7fffd844e680 "", max_size=8192) at lex.ll:3454
#14 0x00007ffff6d6763a in yy_get_next_buffer (yyscanner=0x7fffd844e210) at parse-tree/lex.cc:3429
#15 0x00007ffff6d6719a in octave_lex (yylval_param=0x7fffdc8e82d0, yyscanner=0x7fffd844e210)
    at parse-tree/lex.cc:3299
#16 0x00007ffff6d74047 in octave_pull_parse (yyps=0x0, parser=...) at parse-tree/oct-parse.cc:3801
#17 0x00007ffff6d73fde in octave_parse (parser=...) at parse-tree/oct-parse.cc:3771
#18 0x00007ffff6d81696 in octave_parser::run (this=0x7fffdc8e8340) at oct-parse.yy:3988
#19 0x00007ffff719b6b4 in main_loop () at corefcn/toplev.cc:593
#20 0x00007ffff685cd2d in octave_execute_interpreter () at octave.cc:919
#21 0x00007ffff7a2ba18 in octave_interpreter::execute (this=0x807700)
    at src/octave-interpreter.cc:48
#22 0x00007ffff7a84c21 in octave_interpreter::qt_static_metacall (_o=0x807700,
    _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x807b80) at src/moc-octave-interpreter.cc:58
#23 0x00007ffff2ed2446 in QObject::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#24 0x00007ffff33db894 in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#25 0x00007ffff33e0713 in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#26 0x00007ffff2eb8e9c in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#27 0x00007ffff2ebcc6a in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#28 0x00007ffff2ee7f93 in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#29 0x00007fffed8c6d13 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#30 0x00007fffed8c7060 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#31 0x00007fffed8c7124 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007ffff2ee83bf in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#33 0x00007ffff2eb7c82 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#34 0x00007ffff2eb7ed7 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#35 0x00007ffff2db6fa7 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#36 0x00007ffff2db9fcb in ?? () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#37 0x00007ffff48ede9a in start_thread (arg=0x7fffdc8e9700) at pthread_create.c:308
#38 0x00007ffff461b38d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#39 0x0000000000000000 in ?? ()



Rik <rik5>
Group administrator
Mon 22 Jun 2015 04:16:12 PM UTC, comment #1: 

Thanks for the bug report, I can confirm the crash here on both 4.0.0 and dev.

Mike Miller <mtmiller>
Group Member
Mon 22 Jun 2015 10:42:01 AM UTC, original submission:  

Here is a little script to show the behavior:


clear, close all;
graphics_toolkit qt

I = uint8(ones(50,50,3));
J = ones(50,50,3);

imshow(I);   % --> crash  (double is OK)

%image(I);   % --> errors (double is OK)
%imagesc(I); % --> errors (double is OK)


To reproduce the crash, do the following few steps:
1. in the figure window, press the zoom button "+Z"
2. use the left mouse button inside the plot region to the select a zoom region
3. CRASH, Octave closes

The resulting error messing, when using Octave in CLI mode is:


error: invalid conversion of uint8 matrix to Matrix
error: invalid conversion of uint8 matrix to Matrix
error: octave_base_value::matrix_value(): wrong type argument '<unknown type>'
error: A(I,J): row index out of bounds; value 1 out of bound 0
terminate called after throwing an instance of 'octave_execution_exception'
panic: Abgebrochen -- stopping myself...
attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete


A few observations that might help:

  • This happens only with the qt plotting toolkit. Fltk and gnuplot are fine.
  • This happens only with integer data (uint8 in the above example). Double data is fine.
  • This happened with the 4.0.0 release. I had the crash on a self compiled version on Ubuntu 14.04 as well as on the official Windows installer.
  • If you use image(I) instead of imshow(I) you get error messages  (wich is a bug in itself) but no crash.
  • If you use imagesc(I) instead if imshow, you get error messages (another bug in itself) but no crash.


This behavior is very disturbing, because image data very often IS uint8 data (and not double data). The imread function returns uint8 data normally.

Hartmut <hardy>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #34295:  fix_image_select.patch added by pantxo (1KiB - text/x-diff)

 

Carbon-Copy List
  • -email is unavailable- added by bastia (Posted a comment)
  • -email is unavailable- added by pantxo (Updated the item)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by hardy (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 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-22 mtmiller Dependencies- bugs #46104 is dependent
    2016-02-22 mtmiller Dependencies- bugs #46277 is dependent
    2016-02-22 mtmiller Dependencies- bugs #46885 is dependent
    2015-06-22 pantxo StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2015-06-22 pantxo Attached File- Added fix_image_select.patch, #34295
    2015-06-22 mtmiller Severity3 - Normal 4 - Important
        StatusNone Confirmed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code