fix: crash parsing CLSID in shell.readShortcutLink() (#45348)

* fix: crash parsing CLSID in shell.readShortcutLink

Co-authored-by: David Lönnhager <david.l@mullvad.net>

* fix: ignore clsid if it could not be set

Co-authored-by: David Lönnhager <david.l@mullvad.net>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: David Lönnhager <david.l@mullvad.net>
This commit is contained in:
trop[bot] 2025-02-20 20:21:35 -05:00 committed by GitHub
parent 5a641e02ee
commit 02b85f1e6d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 43 additions and 1 deletions

View file

@ -141,3 +141,4 @@ feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch
feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
cherry-pick-dd8e2822e507.patch cherry-pick-dd8e2822e507.patch
fix_osr_stutter_in_both_cpu_and_gpu_capture_when_page_has_animation.patch fix_osr_stutter_in_both_cpu_and_gpu_capture_when_page_has_animation.patch
ignore_parse_errors_for_pkey_appusermodel_toastactivatorclsid.patch

View file

@ -0,0 +1,40 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?David=20L=C3=B6nnhager?= <dv.lnh.d@gmail.com>
Date: Fri, 17 Jan 2025 14:30:48 +0100
Subject: Ignore parse errors for PKEY_AppUserModel_ToastActivatorCLSID
Some shortcuts store this as a string UUID as opposed to VT_CLSID,
hitting NOTREACHED() and sometimes breaking parsing in Electron.
Ignore this error instead.
Bug: N/A
Change-Id: I9fc472212b2d3afac2c8e18a2159bc2d50bbdf98
diff --git a/AUTHORS b/AUTHORS
index 55dc38c1448c1960b802c136018c8be22ed61c18..5cd195df3650331fbfd62b2f964368b5f3217f3c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -337,6 +337,7 @@ David Futcher <david.mike.futcher@gmail.com>
David Jin <davidjin@amazon.com>
David Lechner <david@pybricks.com>
David Leen <davileen@amazon.com>
+David Lönnhager <dv.lnh.d@gmail.com>
David Manouchehri <david@davidmanouchehri.com>
David McAllister <mcdavid@amazon.com>
David Michael Barr <david.barr@samsung.com>
diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
index e790adb2f1d6529ac0dd77145f5da2796264c7ae..8a7edcfaf9af963468b4b42fe55a771fb31f13a2 100644
--- a/base/win/shortcut.cc
+++ b/base/win/shortcut.cc
@@ -342,8 +342,9 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
*(pv_toast_activator_clsid.get().puuid));
break;
default:
- NOTREACHED() << "Unexpected variant type: "
- << pv_toast_activator_clsid.get().vt;
+ // Shortcuts may use strings to represent the CLSID. This case is
+ // ignored.
+ break;
}
}
}

View file

@ -163,6 +163,7 @@ v8::Local<v8::Value> ReadShortcutLink(gin_helper::ErrorThrower thrower,
options.Set("icon", properties.icon); options.Set("icon", properties.icon);
options.Set("iconIndex", properties.icon_index); options.Set("iconIndex", properties.icon_index);
options.Set("appUserModelId", properties.app_id); options.Set("appUserModelId", properties.app_id);
if (properties.options & ShortcutProperties::PROPERTIES_TOAST_ACTIVATOR_CLSID)
options.Set("toastActivatorClsid", properties.toast_activator_clsid); options.Set("toastActivatorClsid", properties.toast_activator_clsid);
return gin::ConvertToV8(thrower.isolate(), options); return gin::ConvertToV8(thrower.isolate(), options);
} }