Fix SIGSEGV crash in _getActivationToken when appInfo is null#607
Open
doziedotdev wants to merge 2 commits into
Open
Fix SIGSEGV crash in _getActivationToken when appInfo is null#607doziedotdev wants to merge 2 commits into
doziedotdev wants to merge 2 commits into
Conversation
When this.id is null, Gio.AppInfo.create_from_commandline() would receive null as the application name parameter, which could cause issues downstream when the AppInfo is used. Add a fallback chain (this.id || this._commandLine || 'unknown') to ensure appName is never null.
Gio.AppInfo.create_from_commandline() can return null if it fails to create the AppInfo object. Without this check, calling get_startup_notify_id() with a null fakeAppInfo causes a SIGSEGV crash in g_app_info_get_name() -> strlen(NULL). This crash was observed in the wild when clicking tray icons from applications that register with StatusNotifierWatcher without a valid Id property. Stack trace from crash: #0 __strlen_avx2 (libc.so.6) ubuntu#1 sn_internal_strdup (libstartup-notification-1.so.0) ubuntu#2 sn_launcher_context_set_name (libstartup-notification-1.so.0) ubuntu#3 meta_launch_context_get_startup_notify_id (libmutter) Return [launchContext, null] when fakeAppInfo creation fails, allowing callers to handle the missing activation token gracefully.
Collaborator
|
Thanks for your MR, however this was handled upstream via https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4705 Let me know if this is still affecting old gnome shell versions, in case it does, I'm fine adding this check, but only for old versions, would that work for you? |
Collaborator
This is likely the best approach |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a crash (SIGSEGV) that occurs when clicking on certain tray icons. The crash happens in
_getActivationToken()when:this.idis null, causingGio.AppInfo.create_from_commandline()to failfakeAppInfois passed toget_startup_notify_id(), which crashes ing_app_info_get_name()->strlen(NULL)Changes
appName(this.id || this._commandLine || 'unknown') to ensure it's never nullfakeAppInfoto gracefully handle cases wherecreate_from_commandline()failsCrash Details
Stack Trace
Reproduction
Idproperty (observed with some Electron apps)Testing
appNameandfakeAppInfoare never null_getActivationToken()(e.g.,provideActivationToken()) already handle nullactivationTokengracefullyEnvironment