test-org-macro.el: Add test for CVE-2024-30202

* testing/lisp/test-org-macro.el (test-org-macro/initialize-templates):
A new test that no code is evaluated when an Org file is opened
(CVE-2024-30202).

Ihor Radchenko [ANN] Emergency bugfix release: Org mode 9.6.23.
Sun, 24 Mar 2024 17:16:50 +0000.
<https://list.orgmode.org/871q7zbldp.fsf@localhost>
This commit is contained in:
Max Nikulin 2024-05-06 19:04:17 +07:00 committed by Ihor Radchenko
parent 48169da265
commit 51aff8a11b
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 15 additions and 0 deletions

View File

@ -22,6 +22,21 @@
;;; Macros
(ert-deftest test-org-macro/initialize-templates ()
"Test `org-macro-initialize-templates'."
;; No code is executed during loading of Org mode files."
(should
(org-test-with-temp-text
"#+MACRO: title (eval (eval-and-compile (error \"CVE-2024-30202\")))"
(progn
(org-macro-initialize-templates)
t)))
(org-test-with-temp-text
"#+MACRO: title (eval (eval-and-compile (error \"CVE-2024-30202\")))"
(progn
(org-mode)
t)))
(ert-deftest test-org/macro-replace-all ()
"Test `org-macro-replace-all' specifications."
;; Standard test.