From: Richard M. Stallman Date: Mon, 27 Jun 2011 08:01:30 +0000 (-0400) Subject: rmailmm: Handle truncated messages. X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~367 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d31fd9acf0992922c3e9d80eae7c6a74529623ab;p=emacs.git rmailmm: Handle truncated messages. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 499a30d2031..3fcb5e59fc6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-06-27 Richard Stallman + + * mail/rmailmm.el (rmail-mime-process-multipart): + Handle truncated messages. + 2011-06-27 Glenn Morris * progmodes/flymake.el (flymake-err-line-patterns): diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index a02d388a6f7..651defeaf46 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -843,8 +843,18 @@ The other arguments are the same as `rmail-mime-multipart-handler'." ;; the beginning of the next part. The current point is just ;; after the boundary tag. (setq beg (point-min)) - (while (search-forward boundary nil t) - (setq end (match-beginning 0)) + + (while (or (and (search-forward boundary nil t) + (setq end (match-beginning 0))) + ;; If the boundary does not appear at all, + ;; the message was truncated. + ;; Handle the rest of the truncated message + ;; (if it isn't empty) by pretending that the boundary + ;; appears at the end of the message. + (and (save-excursion + (skip-chars-forward "\n") + (> (point-max) (point))) + (setq end (point-max)))) ;; If this is the last boundary according to RFC 2046, hide the ;; epilogue, else hide the boundary only. Use a marker for ;; `next' because `rmail-mime-show' may change the buffer. @@ -852,6 +862,9 @@ The other arguments are the same as `rmail-mime-multipart-handler'." (setq next (point-max-marker))) ((looking-at "[ \t]*\n") (setq next (copy-marker (match-end 0) t))) + ((= end (point-max)) + ;; We're handling what's left of a truncated message. + (setq next (point-max-marker))) (t ;; The original code signalled an error as below, but ;; this line may be a boundary of nested multipart. So,