diff options
author | Noam Postavsky <npostavs@gmail.com> | 2019-07-17 07:20:20 -0400 |
---|---|---|
committer | Noam Postavsky <npostavs@gmail.com> | 2019-07-20 21:35:21 -0400 |
commit | 150bdfe43acde8423612cbff4eafbbb88878b497 (patch) | |
tree | cde38dfb7a9bb330cb718ebd893876e7b15f8c7c /lisp/term.el | |
parent | 021f32cca1b9082e7219b06aee28c00c4323a72a (diff) | |
download | emacs-150bdfe43acde8423612cbff4eafbbb88878b497.tar.gz emacs-150bdfe43acde8423612cbff4eafbbb88878b497.tar.bz2 emacs-150bdfe43acde8423612cbff4eafbbb88878b497.zip |
Handle completely undecoded input in term (Bug#29918)
* lisp/term.el (term-emulate-terminal): Avoid errors if the whole
decoded string is eight-bit characters. Don't attempt to save the
string for next iteration in that case.
* test/lisp/term-tests.el (term-decode-partial)
(term-undecodable-input): New tests.
Diffstat (limited to 'lisp/term.el')
-rw-r--r-- | lisp/term.el | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lisp/term.el b/lisp/term.el index cbef68dc0ac..9785ce30249 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -2900,11 +2900,12 @@ See `term-prompt-regexp'." ;; next time. (when (= funny str-length) (let ((partial 0)) - (while (eq (char-charset (aref decoded-substring - (- count 1 partial))) - 'eight-bit) + (while (and (< partial count) + (eq (char-charset (aref decoded-substring + (- count 1 partial))) + 'eight-bit)) (cl-incf partial)) - (when (> partial 0) + (when (> count partial 0) (setq term-terminal-undecoded-bytes (substring decoded-substring (- partial))) (setq decoded-substring |