From 50fd5124e01e981186cbb0ad6bd547bfd0bdf4a8 Mon Sep 17 00:00:00 2001 From: eabdullin Date: Fri, 29 Mar 2024 14:27:04 +0300 Subject: [PATCH] - escape url passed to gstreamer - add some protocols that don't make sense as floating frame targets - warn about exotic protocols as well - default to ignoring libreoffice special-purpose protocols in calc hyperlink - reuse AllowedLinkProtocolFromDocument in writer - reuse AllowedLinkProtocolFromDocument in impress/draw - CVE-2023-6186 backporting --- SOURCES/0001-CVE-2022-38745.patch | 93 ++ ...-6185-escape-url-passed-to-gstreamer.patch | 69 ++ ...ls-that-don-t-make-sense-as-floating.patch | 93 ++ ...parameter-count-for-OR-AND-and-1-par.patch | 80 ++ SOURCES/0001-disable-script-dump.patch | 99 ++ .../0001-set-Referer-on-loading-IFrames.patch | 93 ++ ...-warn-about-exotic-protocols-as-well.patch | 87 ++ ...ty-belt-before-fishing-in-muddy-wate.patch | 82 ++ ...g-frames-under-managed-links-control.patch | 907 ++++++++++++++++++ ...-a-result-even-if-it-s-only-an-error.patch | 50 + ...ing-libreoffice-special-purpose-prot.patch | 225 +++++ ...me-script-macro-support-isn-t-needed.patch | 54 ++ ...edLinkProtocolFromDocument-in-writer.patch | 281 ++++++ ...kProtocolFromDocument-in-impress-dra.patch | 87 ++ SOURCES/0006-CVE-2023-6186-backporting.patch | 65 ++ SPECS/libreoffice.spec | 71 +- 16 files changed, 2422 insertions(+), 14 deletions(-) create mode 100644 SOURCES/0001-CVE-2022-38745.patch create mode 100644 SOURCES/0001-CVE-2023-6185-escape-url-passed-to-gstreamer.patch create mode 100644 SOURCES/0001-CVE-2023-6186-add-some-protocols-that-don-t-make-sense-as-floating.patch create mode 100644 SOURCES/0001-Obtain-actual-0-parameter-count-for-OR-AND-and-1-par.patch create mode 100644 SOURCES/0001-disable-script-dump.patch create mode 100644 SOURCES/0001-set-Referer-on-loading-IFrames.patch create mode 100644 SOURCES/0002-CVE-2023-6186-warn-about-exotic-protocols-as-well.patch create mode 100644 SOURCES/0002-Stack-check-safety-belt-before-fishing-in-muddy-wate.patch create mode 100644 SOURCES/0002-put-floating-frames-under-managed-links-control.patch create mode 100644 SOURCES/0003-Always-push-a-result-even-if-it-s-only-an-error.patch create mode 100644 SOURCES/0003-CVE-2023-6186-default-to-ignoring-libreoffice-special-purpose-prot.patch create mode 100644 SOURCES/0003-assume-IFrame-script-macro-support-isn-t-needed.patch create mode 100644 SOURCES/0004-CVE-2023-6186-reuse-AllowedLinkProtocolFromDocument-in-writer.patch create mode 100644 SOURCES/0005-CVE-2023-6186-reuse-AllowedLinkProtocolFromDocument-in-impress-dra.patch create mode 100644 SOURCES/0006-CVE-2023-6186-backporting.patch diff --git a/SOURCES/0001-CVE-2022-38745.patch b/SOURCES/0001-CVE-2022-38745.patch new file mode 100644 index 0000000..2f8d64d --- /dev/null +++ b/SOURCES/0001-CVE-2022-38745.patch @@ -0,0 +1,93 @@ +From 36c5c16b7846ff31f403913ad5cdddf8b22fda43 Mon Sep 17 00:00:00 2001 +From: Stephan Bergmann +Date: Mon, 21 Feb 2022 11:55:21 +0100 +Subject: [PATCH] Avoid unnecessary empty -Djava.class.path= + +Change-Id: Idcfe7321077b60381c0273910b1faeb444ef1fd8 +Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130242 +Tested-by: Jenkins +Reviewed-by: Stephan Bergmann +--- + .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 16 +++++++++++++--- + jvmfwk/source/framework.cxx | 8 ++++++-- + jvmfwk/source/fwkbase.cxx | 3 +++ + 3 files changed, 22 insertions(+), 5 deletions(-) + +diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +index 4760ab6..ea133ea 100644 +--- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx ++++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +@@ -687,17 +687,22 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( + // all versions below 1.5.1 + options.emplace_back("abort", reinterpret_cast(abort_handler)); + bool hasStackSize = false; ++#ifdef UNX ++ // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2) ++ // in the class path in order to have applet support: ++ OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion); ++#endif + for (int i = 0; i < cOptions; i++) + { + OString opt(arOptions[i].optionString); + #ifdef UNX +- // Until java 1.5 we need to put a plugin.jar or javaplugin.jar (<1.4.2) +- // in the class path in order to have applet support: + if (opt.startsWith("-Djava.class.path=")) + { +- OString sAddPath = getPluginJarPath(pInfo->sVendor, pInfo->sLocation,pInfo->sVersion); + if (!sAddPath.isEmpty()) ++ { + opt += OStringChar(SAL_PATHSEPARATOR) + sAddPath; ++ sAddPath.clear(); ++ } + } + #endif + if (opt == "-Xint") { +@@ -742,6 +747,11 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( + } + #endif + } ++#ifdef UNX ++ if (!sAddPath.isEmpty()) { ++ options.emplace_back("-Djava.class.path=" + sAddPath, nullptr); ++ } ++#endif + + std::unique_ptr sarOptions(new JavaVMOption[options.size()]); + for (std::vector