diff options
author | Philipp Stephani <phst@google.com> | 2020-05-23 13:56:09 +0200 |
---|---|---|
committer | Philipp Stephani <phst@google.com> | 2020-05-23 14:01:17 +0200 |
commit | f8581bcf6a1942ebd331cae20e32945a3a86a3d1 (patch) | |
tree | 3f1a946cba9cdac5b03f09ec1b01be962256295f /test/lisp/xml-tests.el | |
parent | 232bb691c1095574b85b358c7f33a46d2ea79f29 (diff) | |
download | emacs-f8581bcf6a1942ebd331cae20e32945a3a86a3d1.tar.gz |
Reject invalid characters in XML strings (Bug#41094).
* lisp/xml.el (xml-escape-string): Search for invalid characters.
(xml-invalid-character): New error symbol.
* test/lisp/xml-tests.el (xml-print-invalid-cdata): New unit test.
* etc/NEWS: Document new behavior.
Diffstat (limited to 'test/lisp/xml-tests.el')
-rw-r--r-- | test/lisp/xml-tests.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/lisp/xml-tests.el b/test/lisp/xml-tests.el index 57e685cd347..72c78d00e3e 100644 --- a/test/lisp/xml-tests.el +++ b/test/lisp/xml-tests.el @@ -164,6 +164,16 @@ Parser is called with and without 'symbol-qnames argument.") (should (equal (cdr xml-parse-test--namespace-attribute-qnames) (xml-parse-region nil nil nil nil 'symbol-qnames))))) +(ert-deftest xml-print-invalid-cdata () + "Check that Bug#41094 is fixed." + (with-temp-buffer + (should (equal (should-error (xml-print '((foo () "\0"))) + :type 'xml-invalid-character) + '(xml-invalid-character 0 1))) + (should (equal (should-error (xml-print '((foo () "\u00FF \xFF"))) + :type 'xml-invalid-character) + '(xml-invalid-character #x3FFFFF 3))))) + ;; Local Variables: ;; no-byte-compile: t ;; End: |