diff options
| author | Eli Zaretskii | 2024-10-09 16:21:08 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2024-10-09 16:22:52 +0300 |
| commit | f520008744b1eb71accded4108888d1f2055402e (patch) | |
| tree | 83aab5d287c73022a49b292ebc5dc953b7aff5eb /src/coding.c | |
| parent | 6a5c2edd84fc3fdb879e4a19ea182c2a4d385833 (diff) | |
| download | emacs-f520008744b1eb71accded4108888d1f2055402e.tar.gz emacs-f520008744b1eb71accded4108888d1f2055402e.zip | |
Avoid segfaults in Rmail-MIME
Rmail-MIME decodes text of email, including removal of
CR characters, but that can segfault if the text of some
MIME part is empty.
* src/coding.c (decode_coding_raw_text):
* lisp/mail/rmailmm.el (rmail-mime-insert-decoded-text): Don't
attempt to decode empty text region.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/coding.c b/src/coding.c index b21ed360578..5591b7fed45 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5270,7 +5270,9 @@ decode_coding_raw_text (struct coding_system *coding) | |||
| 5270 | coding->chars_at_source = 1; | 5270 | coding->chars_at_source = 1; |
| 5271 | coding->consumed_char = coding->src_chars; | 5271 | coding->consumed_char = coding->src_chars; |
| 5272 | coding->consumed = coding->src_bytes; | 5272 | coding->consumed = coding->src_bytes; |
| 5273 | if (eol_dos && coding->source[coding->src_bytes - 1] == '\r') | 5273 | if (eol_dos |
| 5274 | && coding->src_bytes > 0 /* empty source text? */ | ||
| 5275 | && coding->source[coding->src_bytes - 1] == '\r') | ||
| 5274 | { | 5276 | { |
| 5275 | coding->consumed_char--; | 5277 | coding->consumed_char--; |
| 5276 | coding->consumed--; | 5278 | coding->consumed--; |