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 686015 - vinagre crashes when connecting
vinagre crashes when connecting
Status: RESOLVED FIXED
Product: libsecret
Classification: Other
Component: General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libsecret maintainer(s)
libsecret maintainer(s)
: 685394 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-10-12 08:59 UTC by Bastien Nocera
Modified: 2012-10-15 12:30 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Better critical preconditions for invalid attributes (6.91 KB, patch)
2012-10-12 09:31 UTC, Stef Walter
none Details | Review
Better critical preconditions for invalid attributes (9.56 KB, patch)
2012-10-12 16:28 UTC, Stef Walter
committed Details | Review

Description Bastien Nocera 2012-10-12 08:59:48 UTC
libsecret from git, vinagre 3.6.0

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff5fe444e in fast_validate (str=0x0) at gutf8.c:1461
1461	  for (p = str; *p; p++)
(gdb) bt
  • #0 fast_validate
    at gutf8.c line 1461
  • #1 g_utf8_validate
    at gutf8.c line 1629
  • #2 secret_attributes_buildv
    at secret-attributes.c line 168
  • #3 secret_password_lookup_sync
    at secret-password.c line 468
  • #4 vinagre_tab_find_credentials_in_keyring
  • #5 vnc_authentication_cb
  • #6 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #7 _g_closure_invoke_va
    at gclosure.c line 840
  • #8 g_signal_emit_valist
    at gsignal.c line 3211
  • #9 g_signal_emit
    at gsignal.c line 3356
  • #10 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #11 _g_closure_invoke_va
    at gclosure.c line 840
  • #12 g_signal_emit_valist
    at gsignal.c line 3211
  • #13 g_signal_emit
    at gsignal.c line 3356
  • #14 do_vnc_connection_emit_main_context
    from /lib64/libgvnc-1.0.so.0
  • #15 g_idle_dispatch
    at gmain.c line 4806
  • #16 g_main_dispatch
    at gmain.c line 2715
  • #17 g_main_context_dispatch
    at gmain.c line 3219
  • #18 g_main_context_iterate
    at gmain.c line 3290
  • #19 g_main_context_iteration
    at gmain.c line 3351
  • #20 g_application_run
    at gapplication.c line 1620
  • #21 main
  • #2 secret_attributes_buildv
    at secret-attributes.c line 168
  • #3 secret_password_lookup_sync
    at secret-password.c line 468
463		g_return_val_if_fail (schema != NULL, NULL);
464		g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), NULL);
465		g_return_val_if_fail (error == NULL || *error == NULL, NULL);
466	
467		va_start (va, error);
468		attributes = secret_attributes_buildv (schema, va);
469		va_end (va);
470	
471		password = secret_password_lookupv_sync (schema, attributes,
472		                                         cancellable, error);
(gdb) p error
$2 = (GError **) 0x0
(gdb) p schema
$3 = (const SecretSchema *) 0x7ffff7dcd9e0 <network_schema>
Comment 1 Stef Walter 2012-10-12 09:09:56 UTC
It looks like vinagre is passing a NULL pointer as a value to secret_password_lookup_sync(). Currently this is undefined.

I thought about this a bit recently.... Perhaps we should define this, as 'don't include the attribute in the search when vararg value is NULL'. That makes it much easier to do searches using varargs without first checking all the values, and using multiple vararg calls when one or more are NULL.
Comment 2 Stef Walter 2012-10-12 09:31:08 UTC
Created attachment 226317 [details] [review]
Better critical preconditions for invalid attributes

* When passing NULL for a string vararg attribute print
   a critical warning.
 * Make all attribute warnings critical
 * Add tests for the various critical warnings

Turns out the above logic about using NULL doesn't really work API wise. It's inconsistent with the integer and boolean attribute varargs. In reality the caller should just check for NULL values, and substitute something appropriate, or not include it in the search.  The above patch cleans up the behavior for libsecret. 

Does the patch produce the expected warning for you Bastien? That way we'll know if I've diagnosed this correctly.
Comment 3 Bastien Nocera 2012-10-12 12:23:06 UTC
A little bit too warny. One of those is a proper warning as well (the GHashTable one).

** (vinagre:20898): CRITICAL **: The value for attribute 'user' was NULL

Program received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffff5fb78e0 in g_logv (log_domain=0x0, log_level=G_LOG_LEVEL_CRITICAL, format=0x7ffff7bbcc00 "The value for attribute '%s' was NULL", args=0x7fffffffc518) at gmessages.c:967
967			G_BREAKPOINT ();
(gdb) bt
  • #0 g_logv
    at gmessages.c line 967
  • #1 g_log
    at gmessages.c line 1003
  • #2 secret_attributes_buildv
    at secret-attributes.c line 169
  • #3 secret_password_lookup_sync
    at secret-password.c line 468
  • #4 vinagre_tab_find_credentials_in_keyring
    at vinagre/vinagre-tab.c line 750
  • #5 vnc_authentication_cb
    at plugins/vnc/vinagre-vnc-tab.c line 495
  • #6 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #7 _g_closure_invoke_va
    at gclosure.c line 840
  • #8 g_signal_emit_valist
    at gsignal.c line 3211
  • #9 g_signal_emit
    at gsignal.c line 3356
  • #10 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #11 _g_closure_invoke_va
    at gclosure.c line 840
  • #12 g_signal_emit_valist
    at gsignal.c line 3211
  • #13 g_signal_emit
    at gsignal.c line 3356
  • #14 do_vnc_connection_emit_main_context
    from /lib64/libgvnc-1.0.so.0
  • #15 g_idle_dispatch
    at gmain.c line 4806
  • #16 g_main_dispatch
    at gmain.c line 2715
  • #17 g_main_context_dispatch
    at gmain.c line 3219
  • #18 g_main_context_iterate
    at gmain.c line 3290
  • #19 g_main_context_iteration
    at gmain.c line 3351
  • #20 g_application_run
    at gapplication.c line 1620
  • #21 main
    at vinagre/vinagre-main.c line 196
  • #0 g_logv
    at gmessages.c line 967
  • #1 g_log
    at gmessages.c line 1003
  • #2 g_return_if_fail_warning
    at gmessages.c line 1012
  • #3 secret_password_lookupv_sync
    at secret-password.c line 611
  • #4 secret_password_lookup_sync
    at secret-password.c line 471
  • #5 vinagre_tab_find_credentials_in_keyring
    at vinagre/vinagre-tab.c line 750
  • #6 vnc_authentication_cb
    at plugins/vnc/vinagre-vnc-tab.c line 495
  • #7 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #8 _g_closure_invoke_va
    at gclosure.c line 840
  • #9 g_signal_emit_valist
    at gsignal.c line 3211
  • #10 g_signal_emit
    at gsignal.c line 3356
  • #11 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #12 _g_closure_invoke_va
    at gclosure.c line 840
  • #13 g_signal_emit_valist
    at gsignal.c line 3211
  • #14 g_signal_emit
    at gsignal.c line 3356
  • #15 do_vnc_connection_emit_main_context
    from /lib64/libgvnc-1.0.so.0
  • #16 g_idle_dispatch
    at gmain.c line 4806
  • #17 g_main_dispatch
    at gmain.c line 2715
  • #18 g_main_context_dispatch
    at gmain.c line 3219
  • #19 g_main_context_iterate
    at gmain.c line 3290
  • #20 g_main_context_iteration
    at gmain.c line 3351
  • #21 g_application_run
    at gapplication.c line 1620
  • #22 main
    at vinagre/vinagre-main.c line 196
  • #0 g_logv
    at gmessages.c line 967
  • #1 g_log
    at gmessages.c line 1003
  • #2 g_return_if_fail_warning
    at gmessages.c line 1012
  • #3 g_hash_table_unref
    at ghash.c line 1020
  • #4 secret_password_lookup_sync
    at secret-password.c line 474
  • #5 vinagre_tab_find_credentials_in_keyring
    at vinagre/vinagre-tab.c line 750
  • #6 vnc_authentication_cb
    at plugins/vnc/vinagre-vnc-tab.c line 495
  • #7 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #8 _g_closure_invoke_va
    at gclosure.c line 840
  • #9 g_signal_emit_valist
    at gsignal.c line 3211
  • #10 g_signal_emit
    at gsignal.c line 3356
  • #11 g_cclosure_marshal_VOID__BOXEDv
    at gmarshal.c line 1160
  • #12 _g_closure_invoke_va
    at gclosure.c line 840
  • #13 g_signal_emit_valist
    at gsignal.c line 3211
  • #14 g_signal_emit
    at gsignal.c line 3356
  • #15 do_vnc_connection_emit_main_context
    from /lib64/libgvnc-1.0.so.0
  • #16 g_idle_dispatch
    at gmain.c line 4806
  • #17 g_main_dispatch
    at gmain.c line 2715
  • #18 g_main_context_dispatch
    at gmain.c line 3219
  • #19 g_main_context_iterate
    at gmain.c line 3290
  • #20 g_main_context_iteration
    at gmain.c line 3351
  • #21 g_application_run
    at gapplication.c line 1620
  • #22 main
    at vinagre/vinagre-main.c line 196

Comment 4 Stef Walter 2012-10-12 16:28:55 UTC
Created attachment 226340 [details] [review]
Better critical preconditions for invalid attributes

* When passing NULL for a string vararg attribute print
   a critical warning.
 * Make all attribute warnings critical
 * Add tests for the various critical warnings

Bastien, how does this look?
Comment 5 Bastien Nocera 2012-10-12 16:43:17 UTC
Looks good:
** (vinagre:14173): CRITICAL **: The value for attribute 'user' was NULL
Comment 6 Stef Walter 2012-10-12 17:48:28 UTC
Attachment 226340 [details] pushed as 7e02a59 - Better critical preconditions for invalid attributes
Comment 7 Stef Walter 2012-10-15 12:30:53 UTC
*** Bug 685394 has been marked as a duplicate of this bug. ***