Bug 641623

Summary: segmentation fault when running ucview with default options with CNF7129 Webcam
Product: [Fedora] Fedora Reporter: Dominik 'Rathann' Mierzejewski <dominik>
Component: libunicapAssignee: Kamil Dudka <kdudka>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: kdudka, redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libunicap-0.9.12-7.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-22 18:02:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dominik 'Rathann' Mierzejewski 2010-10-09 18:35:51 UTC
Description of problem:
Right after starting ucview and just clicking OK on the initial
setup screen, it segfaults. The default options are:
Device: CNF7129
Video Format: YUV 4:2:2 (YUYV) ( YUYV) 640x480

Version-Release number of selected component (if applicable):
libunicap-0.9.12-1.fc13.i686

How reproducible:
Always

Steps to Reproduce:
1. run ucview
2. leave default options unchanged
3. click OK
  
Actual results:
segfault

Expected results:
Normal operation, capture window visible.

Additional info:
Selecting YU12 video format doesn't segfault, but leads to no picture
and a flood of:
** Message: Could not convert format: YU12 32315559 to RGB3 33424752

Selecting YV12 video format works fine.

This doesn't happen with libunicap-0.9.8-1.fc13.

The hardware is Asus Eee PC 901.

The video capture device is
Bus 001 Device 003: ID 04f2:b071 Chicony Electronics Co., Ltd 2.0M UVC Webcam / CNF7129

$ gdb ucview
...
Reading symbols from /usr/bin/ucview...Reading symbols from /usr/lib/debug/usr/bin/ucview.debug...done.
done.
(gdb) run
Starting program: /usr/bin/ucview 
[Thread debugging using libthread_db enabled]
[New Thread 0xb48fcb70 (LWP 6672)]
[New Thread 0xb3cffb70 (LWP 6673)]

(ucview:6653): Gtk-WARNING **: GtkSpinButton: setting an adjustment with non-zero page size is deprecated

(ucview:6653): Gtk-WARNING **: GtkSpinButton: setting an adjustment with non-zero page size is deprecated

(ucview:6653): Gtk-WARNING **: GtkSpinButton: setting an adjustment with non-zero page size is deprecated
[New Thread 0xb30ffb70 (LWP 6674)]
[New Thread 0xb26feb70 (LWP 6675)]
search module path: /home/rathann/.ucview/plugins
search module path: /usr/lib/ucview/plugins

Program received signal SIGSEGV, Segmentation fault.
0x01555d51 in buffer_mgr_queue_all (mgr=0x0) at buffermanager.c:190
190	   for( i = 0; i < mgr->num_buffers; i++ ){
(gdb) bt
#0  0x01555d51 in buffer_mgr_queue_all (mgr=0x0) at buffermanager.c:190
#1  0x015527e0 in v4l2_capture_start (cpi_data=0x80a4b10) at v4l2.c:1934
#2  0x0019b58d in unicap_start_capture (handle=0x81e8860) at unicap.c:1129
#3  0x001383bb in unicapgtk_video_display_start (ugtk=0x81e64c0) at unicapgtk_video_display.c:787
#4  0x0804fa27 in create_main_window (argc=1, argv=0xbffff3e4) at ucview.c:68
#5  main (argc=1, argv=0xbffff3e4) at ucview.c:91

Comment 1 Kamil Dudka 2010-10-09 18:56:29 UTC
Thank you for filing the bug!

Return value of buffer_mgr_create should be checked:

diff --git a/cpi/v4l2cpi/v4l2.c b/cpi/v4l2cpi/v4l2.c
--- a/cpi/v4l2cpi/v4l2.c
+++ b/cpi/v4l2cpi/v4l2.c
@@ -1928,6 +1928,10 @@ static unicap_status_t v4l2_capture_start( void *cpi_data )
    }

    handle->buffer_mgr = buffer_mgr_create( handle->fd, &handle->current_format );
+   if( !handle->buffer_mgr )
+   {
+      return STATUS_FAILURE;
+   }

    handle->capture_running = 1;

Comment 2 Kamil Dudka 2010-10-09 19:06:05 UTC
fixed in libunicap-0.9.12-3.fc15

Comment 3 Kamil Dudka 2010-10-09 19:14:17 UTC
proposed upstream:

https://bugs.launchpad.net/unicap/+bug/657424

Comment 4 Fedora Update System 2010-10-12 12:36:35 UTC
libunicap-0.9.12-2.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/libunicap-0.9.12-2.fc14

Comment 5 Fedora Update System 2010-10-12 12:37:02 UTC
libunicap-0.9.12-2.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/libunicap-0.9.12-2.fc13

Comment 6 Fedora Update System 2010-10-13 06:10:49 UTC
libunicap-0.9.12-2.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update libunicap'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/libunicap-0.9.12-2.fc14

Comment 7 Fedora Update System 2010-10-22 18:02:41 UTC
libunicap-0.9.12-2.fc13 has been pushed to the Fedora 13 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 8 Fedora Update System 2010-10-28 05:53:27 UTC
libunicap-0.9.12-2.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 9 Fedora Update System 2010-10-29 22:31:25 UTC
libunicap-0.9.12-5.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/libunicap-0.9.12-5.fc12

Comment 10 Fedora Update System 2010-10-29 22:31:29 UTC
libunicap-0.9.12-5.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/libunicap-0.9.12-5.el5

Comment 11 Fedora Update System 2010-11-02 16:05:40 UTC
libunicap-0.9.12-6.fc12 has been submitted as an update for Fedora 12.
https://admin.fedoraproject.org/updates/libunicap-0.9.12-6.fc12

Comment 12 Fedora Update System 2010-11-02 16:06:49 UTC
libunicap-0.9.12-7.el5 has been submitted as an update for Fedora EPEL 5.
https://admin.fedoraproject.org/updates/libunicap-0.9.12-7.el5

Comment 13 Fedora Update System 2010-11-10 21:45:49 UTC
libunicap-0.9.12-6.fc12 has been pushed to the Fedora 12 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 14 Fedora Update System 2010-11-18 17:21:00 UTC
libunicap-0.9.12-7.el5 has been pushed to the Fedora EPEL 5 stable repository.  If problems still persist, please make note of it in this bug report.