Bug 52258

Summary: Segmentation fault loading Nikon D300 NEF images
Product: libopenraw Reporter: Stan Angeloff <stanimir>
Component: GeneralAssignee: Hubert Figuiere <hub>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard: [release:0.1.0]
i915 platform: i915 features:

Description Stan Angeloff 2012-07-19 10:27:20 UTC
When opening a .NEF file on a stock Ubuntu Precise 12.04 with libopenraw 0.0.{8,9} installed from source, Eye of Gnome exists with SIGSEGV.

I have the following set up:

1. Stock Ubuntu Precise 12.04 with the default libopenraw1 and libopenrawgnome1 installed:

$ sudo apt-get install --reinstall libopenraw1 libopenrawgnome1

2. Running the latest available kernel and GCC:

$ uname -a
Linux stan-inspiron 3.2.0-26-generic #41-Ubuntu SMP Thu Jun 14 17:49:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

$ gcc --version
gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3

3. A test .NEF image (too big to attach, using Dropbox instead http://dl.dropbox.com/u/24705742/test.NEF)

By default, Ubuntu doesn't come with the pixbuf loader for camera raw images. These are the steps I followed to install libopenraw from source (please note 0.0.8 used to match the version installed in Ubuntu, 0.0.9 has the same behaviour):

--------

$ cd /tmp
$ curl -O http://libopenraw.freedesktop.org/download/libopenraw-0.0.8.tar.gz
$ tar zxvf libopenraw-0.0.8.tar.gz && cd libopenraw-0.0.8
$ sudo apt-get install libboost-test-dev
$ ./configure
$ sudo cp ./gnome/.libs/libopenraw_pixbuf.so /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/
$ sudo gdk-pixbuf-query-loaders --update-cache

--------

Using gdk-pixbuf-query-loaders I can confirm the system now has libcameraraw pixbuf loader installed.

When I attempt to load the test.NEF file I get a segmentation fault as shown in this gdb session:

--------

$ gdb --args eog /data/Dropbox/Public/test.NEF
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2) 7.4-2012.04
This GDB was configured as "x86_64-linux-gnu".
Reading symbols from /usr/bin/eog...(no debugging symbols found)...done.
(gdb) run
Starting program: /usr/bin/eog /data/Dropbox/Public/test.NEF
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7fffed694700 (LWP 17707)]
[New Thread 0x7fffe7df8700 (LWP 17708)]
[New Thread 0x7fffe6b95700 (LWP 17709)]
[New Thread 0x7fffdcca1700 (LWP 17710)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe6b95700 (LWP 17709)]
0x00007fffd38bb22b in OpenRaw::Internals::BitIterator::load (this=0x7fffe6b948d0, numBits=<optimized out>) at bititerator.cpp:46
46                      m_bitBuffer = (m_bitBuffer << 8) | *m_p;
(gdb) q
A debugging session is active.

        Inferior 1 [process 17701] will be killed.

Quit anyway? (y or n) y

--------

I am no good at writing C so I haven't attempted to address the issue. I hope this bug report contains the information you'd need.

Any Qs, please let me know and would be happy to assist.
Comment 1 Hubert Figuiere 2012-07-20 01:56:05 UTC
This is a know bug in libopenraw with D300 files. I haven't managed to find the time to fix it.
Comment 2 Sebastian Pipping 2013-09-16 16:34:54 UTC
Before there's a real fix to this, maybe loading of D300 NEF images should be temporarily disabled in libopenraw?  Without checking, this could even be a security issue.
Comment 3 Hubert Figuiere 2014-04-13 14:06:35 UTC
As of today it works with libopenraw master, at least the samples I have. Maybe it got fixed in the meantime.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.