summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-oe/recipes-support/emacs/emacs_29.1.bb1
-rw-r--r--meta-oe/recipes-support/emacs/files/0001-org-latex-preview-Add-protection-when-untrusted-cont.patch60
2 files changed, 61 insertions, 0 deletions
diff --git a/meta-oe/recipes-support/emacs/emacs_29.1.bb b/meta-oe/recipes-support/emacs/emacs_29.1.bb
index 7d5b3cd3fb..f0666a41c4 100644
--- a/meta-oe/recipes-support/emacs/emacs_29.1.bb
+++ b/meta-oe/recipes-support/emacs/emacs_29.1.bb
@@ -7,6 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464"
7SRC_URI = "https://ftp.gnu.org/pub/gnu/emacs/emacs-${PV}.tar.xz \ 7SRC_URI = "https://ftp.gnu.org/pub/gnu/emacs/emacs-${PV}.tar.xz \
8 file://0001-org-macro-set-templates-Prevent-code-evaluation.patch \ 8 file://0001-org-macro-set-templates-Prevent-code-evaluation.patch \
9 file://0001-lisp-gnus-mm-view.el-mm-display-inline-fontify-Mark-.patch \ 9 file://0001-lisp-gnus-mm-view.el-mm-display-inline-fontify-Mark-.patch \
10 file://0001-org-latex-preview-Add-protection-when-untrusted-cont.patch \
10 " 11 "
11SRC_URI:append:class-target = " \ 12SRC_URI:append:class-target = " \
12 file://use-emacs-native-tools-for-cross-compiling.patch \ 13 file://use-emacs-native-tools-for-cross-compiling.patch \
diff --git a/meta-oe/recipes-support/emacs/files/0001-org-latex-preview-Add-protection-when-untrusted-cont.patch b/meta-oe/recipes-support/emacs/files/0001-org-latex-preview-Add-protection-when-untrusted-cont.patch
new file mode 100644
index 0000000000..085bc31c17
--- /dev/null
+++ b/meta-oe/recipes-support/emacs/files/0001-org-latex-preview-Add-protection-when-untrusted-cont.patch
@@ -0,0 +1,60 @@
1From c5cc03c196306372e53700553e0fb5135f6105e6 Mon Sep 17 00:00:00 2001
2From: Ihor Radchenko <yantar92@posteo.net>
3Date: Tue, 20 Feb 2024 12:47:24 +0300
4Subject: [PATCH] org-latex-preview: Add protection when `untrusted-content' is
5 non-nil
6
7* lisp/org/org.el (org--latex-preview-when-risky): New variable
8controlling how to handle LaTeX previews in Org files from untrusted
9origin.
10(org-latex-preview): Consult `org--latex-preview-when-risky' before
11generating previews.
12
13This patch adds a layer of protection when LaTeX preview is requested
14for an email attachment, where `untrusted-content' is set to non-nil.
15
16CVE: CVE-2024-30204
17
18Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=6f9ea396f49cbe38c2173e0a72ba6af3e03b271c]
19Signed-off-by: Gyorgy Sarvari
20---
21 lisp/org/org.el | 19 +++++++++++++++++++
22 1 file changed, 19 insertions(+)
23
24diff --git a/lisp/org/org.el b/lisp/org/org.el
25index d3e14fe..ab58978 100644
26--- a/lisp/org/org.el
27+++ b/lisp/org/org.el
28@@ -1140,6 +1140,24 @@ the following lines anywhere in the buffer:
29 :package-version '(Org . "8.0")
30 :type 'boolean)
31
32+(defvar untrusted-content) ; defined in files.el
33+(defvar org--latex-preview-when-risky nil
34+ "If non-nil, enable LaTeX preview in Org buffers from unsafe source.
35+
36+Some specially designed LaTeX code may generate huge pdf or log files
37+that may exhaust disk space.
38+
39+This variable controls how to handle LaTeX preview when rendering LaTeX
40+fragments that originate from incoming email messages. It has no effect
41+when Org mode is unable to determine the origin of the Org buffer.
42+
43+An Org buffer is considered to be from unsafe source when the
44+variable `untrusted-content' has a non-nil value in the buffer.
45+
46+If this variable is non-nil, LaTeX previews are rendered unconditionally.
47+
48+This variable may be renamed or changed in the future.")
49+
50 (defcustom org-insert-mode-line-in-empty-file nil
51 "Non-nil means insert the first line setting Org mode in empty files.
52 When the function `org-mode' is called interactively in an empty file, this
53@@ -15687,6 +15705,7 @@ fragments in the buffer."
54 (interactive "P")
55 (cond
56 ((not (display-graphic-p)) nil)
57+ ((and untrusted-content (not org--latex-preview-when-risky)) nil)
58 ;; Clear whole buffer.
59 ((equal arg '(64))
60 (org-clear-latex-preview (point-min) (point-max))