Avoid regexp overflow in mm-decode-content-transfer-encoding
* lisp/gnus/mm-bodies.el (mm-decode-content-transfer-encoding): The base64 may be huge, so avoid backtracking (bug#55195).
This commit is contained in:
parent
0ea0aa255c
commit
d90f54db22
1 changed files with 6 additions and 7 deletions
|
@ -191,18 +191,17 @@ If TYPE is `text/plain' CRLF->LF translation may occur."
|
||||||
((eq encoding 'base64)
|
((eq encoding 'base64)
|
||||||
(base64-decode-region
|
(base64-decode-region
|
||||||
(point-min)
|
(point-min)
|
||||||
;; Some mailers insert whitespace
|
|
||||||
;; junk at the end which
|
|
||||||
;; base64-decode-region dislikes.
|
|
||||||
;; Also remove possible junk which could
|
|
||||||
;; have been added by mailing list software.
|
|
||||||
(save-excursion
|
(save-excursion
|
||||||
|
;; Some mailers insert whitespace junk at the end which
|
||||||
|
;; base64-decode-region dislikes.
|
||||||
(goto-char (point-min))
|
(goto-char (point-min))
|
||||||
(while (re-search-forward "^[\t ]*\r?\n" nil t)
|
(while (re-search-forward "^[\t ]*\r?\n" nil t)
|
||||||
(delete-region (match-beginning 0) (match-end 0)))
|
(delete-region (match-beginning 0) (match-end 0)))
|
||||||
|
;; Also ignore junk which could have been added by
|
||||||
|
;; mailing list software by finding the final line with
|
||||||
|
;; base64 text.
|
||||||
(goto-char (point-max))
|
(goto-char (point-max))
|
||||||
(when (re-search-backward "^[\t ]*[A-Za-z0-9+/]+=*[\t ]*$"
|
(when (re-search-backward "[A-Za-z0-9+/]{3,3}=?[\t ]*$" nil t)
|
||||||
nil t)
|
|
||||||
(forward-line))
|
(forward-line))
|
||||||
(point))))
|
(point))))
|
||||||
((memq encoding '(nil 7bit 8bit binary))
|
((memq encoding '(nil 7bit 8bit binary))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue