cvInvert may cause segmentation fault

Bug #684302 reported by Florian Echtler
20
This bug affects 4 people
Affects Status Importance Assigned to Milestone
opencv (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Binary package hint: libcv2.1

This bug affects libcv2.1.0-2.
Under certain circumstances, calling cvInvert causes a segmentation fault with the following stacktrace:

Program received signal SIGSEGV, Segmentation fault.
0x03d36f4b in ATL_dgemvT_a1_x1_b0_y1 () from /usr/lib/libblas.so.3gf
(gdb) bt
#0 0x03d36f4b in ATL_dgemvT_a1_x1_b0_y1 () from /usr/lib/libblas.so.3gf
#1 0x03d3169b in ATL_dgemv () from /usr/lib/libblas.so.3gf
#2 0xbfffb504 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) quit

This bug does not occur when compiling the package without the Ubuntu patches to opencv-2.1.0/src/cxcore/cxlapack.cpp.
As cvCalibrateCamera* and cvFindChessboardCorners also call cvInvert, this may be the root of some other reported bugs as well.

See also https://code.ros.org/trac/opencv/ticket/656 for a test program causing the bug. Note that this is NOT an upstream bug - compiling from opencv_2.1.0.orig.tar.gz without patches fixes this bug.

Florian

Revision history for this message
Nobuhiro Iwamatsu (iwamatsu) wrote :

Hi,

I dont see me so that a patch apply to opencv-2.1.0/src/cxcore/cxlapack.cpp.

cat debian/patches/*.patch | grep +++
+++ b/src/cv/CMakeLists.txt
+++ b/src/cvaux/CMakeLists.txt
+++ b/src/cxcore/CMakeLists.txt
+++ b/src/highgui/CMakeLists.txt
+++ b/src/ml/CMakeLists.txt
+++ b/3rdparty/CMakeLists.txt 2010-04-26 05:49:17.000000000 +0900
+++ b/src/cxcore/CMakeLists.txt 2010-04-26 06:00:09.000000000 +0900
+++ b/CMakeLists.txt 2010-05-17 05:00:23.000000000 +0900
+++ b/doc/CMakeLists.txt
+++ b/src/cxcore/cxsystem.cpp
+++ b/samples/c/build_all.sh
+++ b/include/opencv/cvinternal.h

Revision history for this message
Florian Echtler (floe) wrote :

I am sorry, that comment about the patch to cxlapack.cpp was my mistake. Nevertheless, the bug can be fixed (at least on i386) by building the package with an empty debian/patches/ directory. Since my original guess was wrong, I can only speculate that the problem is related to fix_3rdparty_build.patch. Maybe it is caused by some incompatibility between the lapack in the package and the one from Ubuntu.

Revision history for this message
Florian Echtler (floe) wrote :
Revision history for this message
Florian Echtler (floe) wrote :

I can confirm that rebuilding the package without fix_3rdparty_build.patch fixes the bug. Would it be possible to disable this patch for x86 builds?

Florian

Revision history for this message
Florian Echtler (floe) wrote :

Here's the quick-and-dirty workaround (maybe not so quick, the rebuild takes quite some time):

apt-get source opencv
cd opencv-2.1.0
rm debian/patches/fix_3rdparty_build.patch
debuild
cd ..
sudo dpkg -i *.deb

Any news on how to fix this in a release?

Florian

Revision history for this message
DisDis (igor-demyanov) wrote :

Hi Florian Echtler.
Your workaround not working for me.
Ubuntu 10.10 32bit
Linux wings 2.6.35-23-generic-pae #41-Ubuntu SMP Wed Nov 24 10:35:46 UTC 2010 i686 GNU/Linux

I installed packets:
sudo apt-get install devscripts quilt quilt libraw1394-dev libdc1394-22-dev liblapack-dev python-dev swig texlive-fonts-extra texlive-latex-extra texlive-latex-recommended latex-xcolor texlive-fonts-recommended

Download sources:
apt-get source opencv

Removal patch "fix_3rdparty_build.patch" leads to an error, so I replaced it with an empty file.

debuild configured - OK.(attached)

debuild make output error:

Building CXX object src/cxcore/CMakeFiles/cxcore_pch_dephelp.dir/cxcore_pch_dephelp.o
cd /home/dis/opencv-2.1.0/obj-i686-linux-gnu/src/cxcore && /usr/bin/c++ -DHAVE_IPP -DHAVE_CONFIG_H -DCVAPI_EXPORTS -g -O2 -Wall -pthread -march=i686 -ffunction-sections -O3 -DNDEBUG -fomit-frame-pointer -ffast-math -mfpmath=387 -DNDEBUG -I/usr/lib/python2.6/dist-packages/numpy/core/include -I/usr/lib/../include -I/home/dis/opencv-2.1.0/. -I/home/dis/opencv-2.1.0/obj-i686-linux-gnu -I/home/dis/opencv-2.1.0/include -I/home/dis/opencv-2.1.0/include/opencv -I/home/dis/opencv-2.1.0/src/cxcore/../../3rdparty/include -I/home/dis/opencv-2.1.0/src/cxcore/../../include/opencv -I/home/dis/opencv-2.1.0/obj-i686-linux-gnu/src/cxcore -D PYTHON_USE_NUMPY=1 -o CMakeFiles/cxcore_pch_dephelp.dir/cxcore_pch_dephelp.o -c /home/dis/opencv-2.1.0/obj-i686-linux-gnu/src/cxcore/cxcore_pch_dephelp.cxx
In file included from /home/dis/opencv-2.1.0/src/cxcore/_cxcore.h:63,
                 from /home/dis/opencv-2.1.0/obj-i686-linux-gnu/src/cxcore/cxcore_pch_dephelp.cxx:1:
/home/dis/opencv-2.1.0/include/opencv/cvinternal.h:99: fatal error: ipp.h: File not found.

How do you solved this problem?

Revision history for this message
Florian Echtler (floe) wrote :

Hm, I forgot to add a line about editing debian/patches/series and removing the fix_3rdparty_build.patch - but apart from that, it works on my machine. Do you have installed anything relating to IPP (Intel Performance Primitives)? Maybe that's causing your error...

Florian

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in opencv (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.