After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 421801 - Yet another vsnprintf crash
Yet another vsnprintf crash
Status: RESOLVED FIXED
Product: ekiga
Classification: Applications
Component: general
GIT master
Other All
: High critical
: ---
Assigned To: Snark
Ekiga maintainers
: 417801 419439 424308 424312 426603 456405 456406 469194 469246 474495 476948 480584 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-03-23 08:56 UTC by Snark
Modified: 2007-10-29 21:24 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix segfault when displaying MovingLogo error dialog (3.48 KB, patch)
2007-03-23 09:38 UTC, Luc Saillard
none Details | Review
Patch to fix the gnomemeeting_warning_dialog_on_widget function (2.93 KB, patch)
2007-03-23 19:54 UTC, Snark
none Details | Review
Patch to fix the gnomemeeting_warning_dialog_on_widget function (638 bytes, patch)
2007-03-24 07:19 UTC, Snark
none Details | Review
Fix segfault when displaying MovingLogo error dialog (removing duplicate call) (523 bytes, patch)
2007-03-24 08:30 UTC, Luc Saillard
none Details | Review

Description Snark 2007-03-23 08:56:48 UTC
Just reported by Luc on an amd64 :
<luc> #3  0x000000000047761f in gnomemeeting_warning_dialog_on_widget (parent=0x8cf350, 
<luc>     key=0x489d30 "/apps/ekiga/devices/video/enable_preview", primary_text=<value optimized out>, 
<luc>     format=0x486618 "%s") at gmdialog.c:495

The lines of code are :
<luc>  gnomemeeting_warning_dialog_on_widget (GTK_WINDOW (main_window),
<luc>             VIDEO_DEVICES_KEY "enable_preview",
<luc>             dialog_title,
<luc>             "%s", dialog_msg);

Can't we just build the string to show, give it to gnomemeeting_warning_dialog_on_widget, then free it ? I'll try to have a look.
Comment 1 Luc Saillard 2007-03-23 09:09:50 UTC
Looking back in the history

  • #0 strlen
    from /lib/libc.so.6
  • #1 vfprintf
    from /lib/libc.so.6
  • #2 vsnprintf
    from /lib/libc.so.6
  • #3 gnomemeeting_warning_dialog_on_widget
    at gmdialog.c line 495
  • #4 GMVideoGrabber::VGOpen
    at devices/videoinput.cpp line 395
  • #5 GMVideoGrabber
    at devices/videoinput.cpp line 83
  • #6 GMManager::CreateVideoGrabber
    at endpoints/manager.cpp line 502
  • #7 GMManager::UpdateDevices
    at endpoints/manager.cpp line 218
  • #8 GMManager::Init
    at endpoints/manager.cpp line 1549
  • #9 main
    at gui/main.cpp line 4680

Comment 2 Luc Saillard 2007-03-23 09:21:13 UTC
Ok i've reproduce it:

(gdb) thread apply all backtrace 

Thread 3 (Thread 1074272608 (LWP 11159))

  • #0 __lll_mutex_lock_wait
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/lowlevellock.S line 59
  • #1 ??
  • #2 ??

Thread 1 (Thread 46912574814256 (LWP 11153))

  • #0 strlen
    at ../sysdeps/x86_64/strlen.S line 37
  • #1 _IO_vfprintf
    from /usr/lib/debug/libc.so.6
  • #2 _IO_vsnprintf
    from /usr/lib/debug/libc.so.6
  • #3 gnomemeeting_warning_dialog_on_widget
    at gmdialog.c line 495
  • #4 GMVideoGrabber::VGOpen
    at devices/videoinput.cpp line 397
  • #5 GMVideoGrabber
    at devices/videoinput.cpp line 83
  • #6 GMManager::CreateVideoGrabber
    at endpoints/manager.cpp line 502
  • #7 GMManager::UpdateDevices
    at endpoints/manager.cpp line 218
  • #8 GMManager::Init
    at endpoints/manager.cpp line 1549
  • #9 main
    at gui/main.cpp line 4680

Comment 3 Luc Saillard 2007-03-23 09:36:48 UTC
One solution is to remove the use of vsprintf in the gnomemeeting_dialog_error_box.

I've rewritten the code to be like this (patch follow)

/* Translators: Do not translate MovingLogo and Picture */
static const char *error_code_strings[] =
 {
   NULL,
   N_("There was an error while opening the device. ...."),
   N_("Your video driver doesn't support the requested video format."),
   N_("Could not open the chosen channel."),
   N_("Your driver doesn't seem to support a...."),
   N_("Error while setting the frame rate."),
   N_("Error while setting the frame size."),
 };

/* If we want to open the fake device for a real error, and not because
   the user chose the Picture device */
gnomemeeting_threads_enter ();
gm_history_window_insert (history_window, 
			  _("Couldn't open the video device"));

dialog_title =
  g_strdup_printf (_("Error while opening video device %s"),
		   (const char *) input_device);

dialog_msg = g_strdup_printf(_("A moving logo w.... device.\n\n%s"),
			     _(error_code_strings[error_code]));

gnomemeeting_warning_dialog_on_widget (GTK_WINDOW (main_window),
				       VIDEO_DEVICES_KEY "enable_preview",
				       dialog_title,
				       dialog_msg, NULL);
g_free (dialog_msg);
g_free (dialog_title);
Comment 4 Luc Saillard 2007-03-23 09:38:47 UTC
Created attachment 85166 [details] [review]
Fix segfault when displaying MovingLogo error dialog

A better solution will be to replace all call to gnomemeeting_warning_dialog_on_widget with a safe string.
Comment 5 Snark 2007-03-23 09:44:55 UTC
Hmmmm... two remarks about attachment #85166 [details] :
- it removes a blank line after a "else {" ;-)
- it doesn't give the same error message since it drops the first part of the error message.

I'll try to work on the better solution : get rid of the va_list which isn't really used anyway!
Comment 6 Damien Sandras 2007-03-23 10:40:16 UTC
Can you do that this week-end ?

I'd like to release 2.0.8 ASAP.

Why does the vsnprintf crash ?
Isn't it the same bug than the one that was fixed Bug #418991 ?
Comment 7 Damien Sandras 2007-03-23 10:45:23 UTC
Perhaps just adding a missing va_end will help.


Also, that code is old. It never crashed before. Isn't that the same kind of bug with the PPLuginServiceDescriptor Bug #417801 ?

Guys, we need to fix those two ASAP.
Comment 8 Snark 2007-03-23 19:54:10 UTC
Created attachment 85202 [details] [review]
Patch to fix the gnomemeeting_warning_dialog_on_widget function

There was a va_end.

I couldn't help but notice that there were other functions in there which use format strings : I didn't touch them since I was unsure the fix was as easy.

Better do things stage by stage.
Comment 9 Snark 2007-03-23 20:01:22 UTC
Now that I think about it, there was indeed a va_end, but not on all exit paths of the function... doesn't that lead to a corrupt stack ?
Comment 10 Snark 2007-03-24 07:19:53 UTC
Created attachment 85214 [details] [review]
Patch to fix the gnomemeeting_warning_dialog_on_widget function

Ok, here is another simpler patch, which just makes sure we do the va_start after we decided for hid/don't hide : this makes the code do the va_start/va_end as a whole or not at all.

Luc, since you can reproduce, could you please check if that is a correct fix ?
Comment 11 Snark 2007-03-24 08:30:48 UTC
Comparing :

http://svn.gnome.org/viewcvs/ekiga/tags/EKIGA_2_0_7/lib/gui/gmdialog.c?revision=4959&view=markup

and

http://svn.gnome.org/viewcvs/ekiga/trunk/lib/gui/gmdialog.c?view=markup

Luc saw there were *two* vsnprintf calls!

I still propose my patch, but indeed one of them has to go!
Comment 12 Luc Saillard 2007-03-24 08:30:49 UTC
Created attachment 85215 [details] [review]
Fix segfault when displaying MovingLogo error dialog (removing duplicate call)

The bug is too stupid, two calls to vsnprintf() in the same function at least in the 2.0.7 release.
Comment 13 Luc Saillard 2007-03-24 08:31:25 UTC
i think the two last patch need to be applied.
Comment 14 Snark 2007-03-24 09:14:00 UTC
I committed the va_start push in gnome-2-14, trunk and H_Release branches. I didn't see the double vsnprintf in those branches.
Comment 15 Snark 2007-03-25 06:55:11 UTC
*** Bug 417801 has been marked as a duplicate of this bug. ***
Comment 16 Snark 2007-03-30 04:14:17 UTC
*** Bug 424312 has been marked as a duplicate of this bug. ***
Comment 17 Snark 2007-03-30 04:14:17 UTC
*** Bug 424308 has been marked as a duplicate of this bug. ***
Comment 18 Snark 2007-04-05 14:15:32 UTC
*** Bug 426603 has been marked as a duplicate of this bug. ***
Comment 19 Snark 2007-04-05 14:16:22 UTC
*** Bug 419439 has been marked as a duplicate of this bug. ***
Comment 20 Jan Schampera 2007-07-13 03:45:59 UTC
*** Bug 456405 has been marked as a duplicate of this bug. ***
Comment 21 Jan Schampera 2007-07-13 03:46:51 UTC
*** Bug 456406 has been marked as a duplicate of this bug. ***
Comment 22 Damien Sandras 2007-08-22 10:46:27 UTC
*** Bug 469194 has been marked as a duplicate of this bug. ***
Comment 23 Snark 2007-08-22 15:03:16 UTC
*** Bug 469246 has been marked as a duplicate of this bug. ***
Comment 24 Snark 2007-09-07 11:10:41 UTC
*** Bug 474495 has been marked as a duplicate of this bug. ***
Comment 25 Snark 2007-09-14 17:24:57 UTC
*** Bug 476948 has been marked as a duplicate of this bug. ***
Comment 26 Snark 2007-10-29 21:24:34 UTC
*** Bug 480584 has been marked as a duplicate of this bug. ***