Repository: electron/electron
Pull request: fix: possible crash in `shell.readShortcutLink`

Backport of #46294

See that PR for details.


Notes: Fixed a possible crash in `shell.readShortcutLink`.


Changed files:
filename: patches/chromium/.patches
patch: @@ -136,7 +136,7 @@ refactor_unfilter_unresponsive_events.patch
 build_disable_thin_lto_mac.patch
 build_add_public_config_simdutf_config.patch
 revert_code_health_clean_up_stale_macwebcontentsocclusion.patch
-ignore_parse_errors_for_pkey_appusermodel_toastactivatorclsid.patch
+ignore_parse_errors_for_resolveshortcutproperties.patch
 feat_add_signals_when_embedder_cleanup_callbacks_run_for.patch
 feat_separate_content_settings_callback_for_sync_and_async_clipboard.patch
 fix_win32_synchronous_spellcheck.patch

filename: patches/chromium/ignore_parse_errors_for_pkey_appusermodel_toastactivatorclsid.patch
patch: @@ -1,40 +0,0 @@
-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 b55c6916e97a7c8e317145f5239a34d8abca810e..dbd924a91a8fca8ff9d85bf6addcdb5a7b17ca3a 100644
---- a/AUTHORS
-+++ b/AUTHORS
-@@ -341,6 +341,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 967e130e823f41c402411dfadb53b805e8a8c92b..3a9df7f31861ca69168fd24513ee554d0984798d 100644
---- a/base/win/shortcut.cc
-+++ b/base/win/shortcut.cc
-@@ -356,8 +356,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;
-       }
-     }
-   }

filename: patches/chromium/ignore_parse_errors_for_resolveshortcutproperties.patch
patch: @@ -0,0 +1,45 @@
+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 in ResolveShortcutProperties
+
+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.
+
+diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc
+index 967e130e823f41c402411dfadb53b805e8a8c92b..c1cc95fa8993cc5bdab422710934fb6217272b96 100644
+--- a/base/win/shortcut.cc
++++ b/base/win/shortcut.cc
+@@ -317,7 +317,8 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
+           break;
+         }
+         default: {
+-          NOTREACHED() << "Unexpected variant type: " << pv_app_id.get().vt;
++          LOG(WARNING) << "Unexpected variant type: " << pv_app_id.get().vt;
++          break;
+         }
+       }
+     }
+@@ -336,7 +337,8 @@ bool ResolveShortcutProperties(const FilePath& shortcut_path,
+           properties->set_dual_mode(pv_dual_mode.get().boolVal == VARIANT_TRUE);
+           break;
+         default:
+-          NOTREACHED() << "Unexpected variant type: " << pv_dual_mode.get().vt;
++          LOG(WARNING) << "Unexpected variant type: " << pv_dual_mode.get().vt;
++          break;
+       }
+     }
+ 
+@@ -356,8 +358,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;
++          LOG(INFO) << "Unexpected variant type: "
++                    << pv_toast_activator_clsid.get().vt;
++          break;
+       }
+     }
+   }