diff options
| author | Eli Zaretskii | 2021-11-04 20:33:26 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2021-11-04 20:33:26 +0200 |
| commit | b96855310efed13e0db1403759b686b9bc3e7490 (patch) | |
| tree | f55f98d13e860f5f3f48180355567d0ff7ae040a /test/src | |
| parent | f875ed53f6795c5bc12e2a73070b87eb34168014 (diff) | |
| download | emacs-b96855310efed13e0db1403759b686b9bc3e7490.tar.gz emacs-b96855310efed13e0db1403759b686b9bc3e7490.zip | |
Better detection of potentially malicious bidi text
* src/bidi.c (bidi_find_first_overridden): Extend to detect more
subtle effects of directional formatting controls, to include
embeddings and isolates.
* src/xdisp.c (Fbidi_find_overridden_directionality): Accept an
additional argument BASE-DIR to specify the base direction of the
paragraphs.
* lisp/international/mule-cmds.el (confusingly-reordered): New
face.
(reorder-starters, reorder-enders): New variables.
(highlight-confusing-reorderings): New command to detect and
highlight suspiciously reordered text.
* test/src/xdisp-tests.el
(xdisp-tests--find-directional-overrides): New test.
* etc/NEWS: Announce the new and improved features.
* etc/tutorials/TUTORIAL.he: Fix embeddings with incorrect
directions.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/xdisp-tests.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el index 4e7d2ad8ab2..a385ded8e1d 100644 --- a/test/src/xdisp-tests.el +++ b/test/src/xdisp-tests.el | |||
| @@ -99,4 +99,19 @@ | |||
| 99 | (width-in-chars (/ (car size) char-width))) | 99 | (width-in-chars (/ (car size) char-width))) |
| 100 | (should (equal width-in-chars 3))))) | 100 | (should (equal width-in-chars 3))))) |
| 101 | 101 | ||
| 102 | (ert-deftest xdisp-tests--find-directional-overrides () | ||
| 103 | (with-temp-buffer | ||
| 104 | (insert "\ | ||
| 105 | int main() { | ||
| 106 | bool isAdmin = false; | ||
| 107 | /* }if (isAdmin) begin admins only */ | ||
| 108 | printf(\"You are an admin.\\n\"); | ||
| 109 | /* end admins only { */ | ||
| 110 | return 0; | ||
| 111 | }") | ||
| 112 | (goto-char (point-min)) | ||
| 113 | (should (eq (bidi-find-overridden-directionality (point-min) (point-max) | ||
| 114 | nil) | ||
| 115 | 46)))) | ||
| 116 | |||
| 102 | ;;; xdisp-tests.el ends here | 117 | ;;; xdisp-tests.el ends here |