emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 636e9fd: Fix args-out-of-range error in epa-file-insert-file-cont


From: Lars Ingebrigtsen
Subject: master 636e9fd: Fix args-out-of-range error in epa-file-insert-file-contents
Date: Mon, 12 Apr 2021 04:18:42 -0400 (EDT)

branch: master
commit 636e9fd6a0c6b7801fd5a0d58fd42c93aab7332d
Author: Junya Takahashi <jutakat@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Fix args-out-of-range error in epa-file-insert-file-contents
    
    * lisp/epa-file.el (epa-file-insert-file-contents): Don't bug out
    on a region that's longer than the file (bug#47718).
    
    Copyright-paperwork-exempt: yes
---
 lisp/epa-file.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index e46e368..33bf5ad 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -198,7 +198,9 @@ encryption is used."
                       (mapcar #'car (epg-context-result-for
                                      context 'encrypted-to)))
          (if (or beg end)
-             (setq string (substring string (or beg 0) end)))
+              (setq string (substring string
+                                      (or beg 0)
+                                      (and end (min end (length string))))))
          (save-excursion
            ;; If visiting, bind off buffer-file-name so that
            ;; file-locking will not ask whether we should



reply via email to

[Prev in Thread] Current Thread [Next in Thread]