[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44411: 28.0.50; uudecode-decode-region-internal is broken
From: |
Kazuhiro Ito |
Subject: |
bug#44411: 28.0.50; uudecode-decode-region-internal is broken |
Date: |
Wed, 04 Nov 2020 17:26:56 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (Gojō) APEL-LB/10.8 Emacs/28.0.50 (x86_64-w64-mingw32) MULE/6.0 (HANACHIRUSATO) |
> > When I call uudecode-decode-region-internal in multibyte buffer, it
> > fails to decode eight-bit characters.
>
> What do you mean by "decode eight-bit characters"?
I mean "decode uuencoded raw bytes 128-255 as eight-bit characters".
> How could such "characters" appear in uuencoded email message?
I did not said anything about uuencoded email message. What do you
mean?
> Can you describe the real-life use case where this happened?
1. Yank below uuencoded string into multibyte buffer.
begin 644 c8c8c8c8.bin
$R,C(R```@
``
end
size 4
2. C-SPC at the beginning of uuencoded text and move point to the end
of uuencoded text.
3. M-x uudecode-decode-region-internal
4. decoded result is broken. Original data is 4bytes of 0xc8, but
inserted text is "8888". uudecode-decode-region-external returns
expected result.
> Please show only the changes to fix what you think is a bug.
Here is.
diff --git a/lisp/mail/uudecode.el b/lisp/mail/uudecode.el
index bcbd571b53..81a0a8ae0d 100644
--- a/lisp/mail/uudecode.el
+++ b/lisp/mail/uudecode.el
@@ -151,9 +151,9 @@ uudecode-decode-region-internal
(cond ((= counter 4)
(setq result (cons
(concat
- (char-to-string (ash bits -16))
- (char-to-string (logand (ash bits -8) 255))
- (char-to-string (logand bits 255)))
+ (unibyte-string (ash bits -16))
+ (unibyte-string (logand (ash bits -8) 255))
+ (unibyte-string (logand bits 255)))
result))
(setq bits 0 counter 0))
(t (setq bits (ash bits 6)))))))
@@ -168,12 +168,12 @@ uudecode-decode-region-internal
((= counter 3)
(setq result (cons
(concat
- (char-to-string (logand (ash bits -16) 255))
- (char-to-string (logand (ash bits -8) 255)))
+ (unibyte-string (logand (ash bits -16) 255))
+ (unibyte-string (logand (ash bits -8) 255)))
result)))
((= counter 2)
(setq result (cons
- (char-to-string (logand (ash bits -10) 255))
+ (unibyte-string (logand (ash bits -10) 255))
result))))
(skip-chars-forward non-data-chars end))
(if file-name
@@ -184,7 +184,7 @@ uudecode-decode-region-internal
(goto-char start)
(if enable-multibyte-characters
(dolist (x (nreverse result))
- (insert (decode-coding-string x 'binary)))
+ (insert x))
(insert (apply #'concat (nreverse result))))
(delete-region (point) end))))))
--
Kazuhiro Ito
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken, Kazuhiro Ito, 2020/11/03
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken, Lars Ingebrigtsen, 2020/11/03
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken, Eli Zaretskii, 2020/11/03
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken,
Kazuhiro Ito <=
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken, Eli Zaretskii, 2020/11/04
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken, Kazuhiro Ito, 2020/11/05
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken, Eli Zaretskii, 2020/11/05
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken, Eli Zaretskii, 2020/11/07
- bug#44411: 28.0.50; uudecode-decode-region-internal is broken, Kazuhiro Ito, 2020/11/09