summaryrefslogtreecommitdiffstats
path: root/meta-oe
diff options
context:
space:
mode:
authorGyorgy Sarvari <skandigraun@gmail.com>2025-10-19 19:37:08 +0200
committerAnuj Mittal <anuj.mittal@intel.com>2025-10-30 14:44:28 +0800
commitb0edb9f89158f92d705d4d81da1e69e67c059c7a (patch)
treecf1eec6245bfdd5bcad34747b3f5521edd18cf4c /meta-oe
parent1c65291a77d84b10a73868da2a39443b46ca3025 (diff)
downloadmeta-openembedded-b0edb9f89158f92d705d4d81da1e69e67c059c7a.tar.gz
emacs: patch CVE-2024-30202
Details: https://nvd.nist.gov/vuln/detail/CVE-2024-30202 Backport the patch mentioned in the details of the link. Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com> Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Diffstat (limited to 'meta-oe')
-rw-r--r--meta-oe/recipes-support/emacs/emacs_29.1.bb1
-rw-r--r--meta-oe/recipes-support/emacs/files/0001-org-macro-set-templates-Prevent-code-evaluation.patch47
2 files changed, 48 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 5cbe4551c0..5375c17f30 100644
--- a/meta-oe/recipes-support/emacs/emacs_29.1.bb
+++ b/meta-oe/recipes-support/emacs/emacs_29.1.bb
@@ -5,6 +5,7 @@ LICENSE = "GPL-3.0-only"
5LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464" 5LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464"
6 6
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 " 9 "
9SRC_URI:append:class-target = " \ 10SRC_URI:append:class-target = " \
10 file://use-emacs-native-tools-for-cross-compiling.patch \ 11 file://use-emacs-native-tools-for-cross-compiling.patch \
diff --git a/meta-oe/recipes-support/emacs/files/0001-org-macro-set-templates-Prevent-code-evaluation.patch b/meta-oe/recipes-support/emacs/files/0001-org-macro-set-templates-Prevent-code-evaluation.patch
new file mode 100644
index 0000000000..c88843da59
--- /dev/null
+++ b/meta-oe/recipes-support/emacs/files/0001-org-macro-set-templates-Prevent-code-evaluation.patch
@@ -0,0 +1,47 @@
1From 7b1f10c152e69a32155c0291b9c8e83a8e28ebff Mon Sep 17 00:00:00 2001
2From: Ihor Radchenko <yantar92@posteo.net>
3Date: Tue, 20 Feb 2024 12:19:46 +0300
4Subject: [PATCH] org-macro--set-templates: Prevent code evaluation
5
6* lisp/org/org-macro.el (org-macro--set-templates): Get rid of any
7risk to evaluate code when `org-macro--set-templates' is called as a
8part of major mode initialization. This way, no code evaluation is
9ever triggered when user merely opens the file or when
10`mm-display-org-inline' invokes Org major mode to fontify mime part
11preview in email messages.
12
13CVE: CVE-2024-30202
14
15Upstream-Status: Backport [https://cgit.git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=befa9fcaae29a6c9a283ba371c3c5234c7f644eb]
16Signed-off-by: Gyorgy Sarvari <skandigraun@gmail.com>
17---
18 lisp/org/org-macro.el | 9 ++++++++-
19 1 file changed, 8 insertions(+), 1 deletion(-)
20
21diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
22index 481e431..a3b5c6e 100644
23--- a/lisp/org/org-macro.el
24+++ b/lisp/org/org-macro.el
25@@ -109,6 +109,13 @@ previous one, unless VALUE is nil. Return the updated list."
26 (let ((new-templates nil))
27 (pcase-dolist (`(,name . ,value) templates)
28 (let ((old-definition (assoc name new-templates)))
29+ ;; This code can be evaluated unconditionally, as a part of
30+ ;; loading Org mode. We *must not* evaluate any code present
31+ ;; inside the Org buffer while loading. Org buffers may come
32+ ;; from various sources, like received email messages from
33+ ;; potentially malicious senders. Org mode might be used to
34+ ;; preview such messages and no code evaluation from inside the
35+ ;; received Org text should ever happen without user consent.
36 (when (and (stringp value) (string-match-p "\\`(eval\\>" value))
37 ;; Pre-process the evaluation form for faster macro expansion.
38 (let* ((args (org-macro--makeargs value))
39@@ -121,7 +128,7 @@ previous one, unless VALUE is nil. Return the updated list."
40 (cadr (read value))
41 (error
42 (user-error "Invalid definition for macro %S" name)))))
43- (setq value (eval (macroexpand-all `(lambda ,args ,body)) t))))
44+ (setq value `(lambda ,args ,body))))
45 (cond ((and value old-definition) (setcdr old-definition value))
46 (old-definition)
47 (t (push (cons name (or value "")) new-templates)))))