GNU bug report logs - #1809
decode-coding-inserted-region corrupts files

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 6 Jan 2009 17:55:03 UTC

Severity: normal

Merged with 2416

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1809 in the body.
You can then email your comments to 1809 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1809; Package emacs. (Tue, 06 Jan 2009 17:55:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Tue, 06 Jan 2009 17:55:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: emacs-pretest-bug <at> gnu.org
Subject: 23.0.60; epa-encrypt-file corrupts files
Date: Tue, 06 Jan 2009 19:32:12 +0200
Test case:

1. Create a file `test' with the following 3 lines:

Test.
Test2.
Test3.

2. Save it.

3. Call `epa-encrypt-file' to encrypt it with no key
using symmetric encryption giving the password "test".

4. Visit the file `test.gpg' using the password "test".

5. The decoded buffer has the corrupted content:

^@est.
Test2.
Test3.

where ^@ is a NULL control character.

GNU Emacs 23.0.60 (x86_64-pc-linux-gnu) of 2009-01-06

-- 
Juri Linkov
http://www.jurta.org/emacs/




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1809; Package emacs. (Thu, 15 Jan 2009 01:40:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 15 Jan 2009 01:40:04 GMT) Full text and rfc822 format available.

Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: 1809 <at> debbugs.gnu.org
Cc: emacs-pretest-bug <at> gnu.org
Subject: Re: bug#1809: decode-coding-inserted-region corrupts files
Date: Thu, 15 Jan 2009 03:12:17 +0200
Below is a shorter test case simplified from `epa-file-decode-and-insert':

1. emacs -Q

2. Evaluate

(progn
  (switch-to-buffer "test")
  (insert "Test.\nTest2.\nTest3.\n")
  (decode-coding-inserted-region
   (point-min) (point-max) "/tmp/test" t nil nil nil))

3. The first character becomes the NULL control character:

^@est.
Test2.
Test3.

-- 
Juri Linkov
http://www.jurta.org/emacs/




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1809; Package emacs. (Thu, 15 Jan 2009 01:40:06 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 15 Jan 2009 01:40:06 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1809; Package emacs. (Thu, 15 Jan 2009 02:50:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 15 Jan 2009 02:50:02 GMT) Full text and rfc822 format available.

Message #20 received at 1809 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Juri Linkov" <juri <at> jurta.org>
Cc: 1809 <at> debbugs.gnu.org
Subject: Re: bug#1809: decode-coding-inserted-region corrupts files
Date: Thu, 15 Jan 2009 03:40:22 +0100
On Thu, Jan 15, 2009 at 02:12, Juri Linkov <juri <at> jurta.org> wrote:

> (progn
>  (switch-to-buffer "test")
>  (insert "Test.\nTest2.\nTest3.\n")
>  (decode-coding-inserted-region
>   (point-min) (point-max) "/tmp/test" t nil nil nil))

(with-temp-buffer
   (insert (make-string 20 ?.))
   (decode-coding-region 1 (point-max) 'raw-text)
   (buffer-string))

 => "^@..................."

It only happens for a string of length 20 bytes.

    Juanma




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1809; Package emacs. (Thu, 15 Jan 2009 23:15:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juri Linkov <juri <at> jurta.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 15 Jan 2009 23:15:06 GMT) Full text and rfc822 format available.

Message #25 received at 1809 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juri Linkov <juri <at> jurta.org>
To: "Juanma Barranquero" <lekktu <at> gmail.com>
Cc: 1809 <at> debbugs.gnu.org
Subject: Re: bug#1809: decode-coding-inserted-region corrupts files
Date: Fri, 16 Jan 2009 01:02:38 +0200
>> (progn
>>  (switch-to-buffer "test")
>>  (insert "Test.\nTest2.\nTest3.\n")
>>  (decode-coding-inserted-region
>>   (point-min) (point-max) "/tmp/test" t nil nil nil))
>
> (with-temp-buffer
>    (insert (make-string 20 ?.))
>    (decode-coding-region 1 (point-max) 'raw-text)
>    (buffer-string))
>
>  => "^@..................."
>
> It only happens for a string of length 20 bytes.

Does this mean I was lucky discovering the exact length where the bug
manifests itself?

-- 
Juri Linkov
http://www.jurta.org/emacs/




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1809; Package emacs. (Thu, 15 Jan 2009 23:40:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Juanma Barranquero <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Thu, 15 Jan 2009 23:40:04 GMT) Full text and rfc822 format available.

Message #30 received at 1809 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Juri Linkov <juri <at> jurta.org>
Cc: 1809 <at> debbugs.gnu.org
Subject: Re: bug#1809: decode-coding-inserted-region corrupts files
Date: Fri, 16 Jan 2009 00:35:19 +0100
On Fri, Jan 16, 2009 at 00:02, Juri Linkov <juri <at> jurta.org> wrote:

>> It only happens for a string of length 20 bytes.
>
> Does this mean I was lucky discovering the exact length where the bug
> manifests itself?

Yes, at least up to 10,000  :-)

For extra fun, you can try with length = 10 and multibyte chars like á, ç or ñ.

BTW, testing this I triggered an assertion failure, but it was on
redisplay_code and likely unrelated.

    Juanma


xdisp.c: 6066 => xassert (IT_BYTEPOS (*it) == CHAR_TO_BYTE (IT_CHARPOS (*it)));

#0  0x7c91120f in ntdll!DbgUiConnectToDbg () from C:\WINDOWS\system32\ntdll.dll
#1  0x011ff651 in w32_abort () at w32fns.c:7295
#2  0x010313b7 in set_iterator_to_next (it=0x82dc74, reseat_p=1) at xdisp.c:6066
#3  0x0103144e in set_iterator_to_next (it=0x82dc74, reseat_p=1) at xdisp.c:6113
#4  0x0103bd55 in display_line (it=0x82dc74) at xdisp.c:16926
#5  0x01040694 in try_window (window=67652100, pos={charpos = 1,
bytepos = 1}, check_margins=1) at xdisp.c:14054
#6  0x01054dc7 in redisplay_window (window=67652100,
just_this_one_p=1) at xdisp.c:13677
#7  0x01056f79 in redisplay_window_1 (window=67652100) at xdisp.c:12281
#8  0x010190f1 in internal_condition_case_1 (bfun=0x1056f53
<redisplay_window_1>, arg=67652100, handlers=47871253,
    hfun=0x1023ce8 <redisplay_window_error>) at eval.c:1559
#9  0x01048077 in redisplay_internal (preserve_echo_area=<value
optimized out>) at xdisp.c:11899
#10 0x0108ebdb in read_char (commandflag=1, nmaps=6, maps=0x82fb50,
prev_event=47888385, used_mouse_menu=0x82fc24, end_time=0x0)
    at keyboard.c:2666
#11 0x0109327a in read_key_sequence (keybuf=0x82fcc4, bufsize=30,
prompt=47888385, dont_downcase_last=0, can_return_switch_frame=1,
    fix_current_buffer=1) at keyboard.c:9365
#12 0x010963d1 in command_loop_1 () at keyboard.c:1631
#13 0x01019376 in internal_condition_case (bfun=0x1096143
<command_loop_1>, handlers=47952065, hfun=0x108d371 <cmd_error>) at
eval.c:1511
#14 0x0108c802 in command_loop_2 () at keyboard.c:1348
#15 0x01019420 in internal_catch (tag=47948185, func=0x108c7df
<command_loop_2>, arg=47888385) at eval.c:1247
#16 0x0108d1b2 in command_loop () at keyboard.c:1327
#17 0x0108d509 in recursive_edit_1 () at keyboard.c:942
#18 0x0108d675 in Frecursive_edit () at keyboard.c:1004
#19 0x01002fb1 in main (argc=2, argv=0xa93cf8) at emacs.c:1786




Merged 1809 2416. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 22 Feb 2009 05:50:05 GMT) Full text and rfc822 format available.

Changed bug title to `decode-coding-inserted-region corrupts files' from `23.0.60; epa-encrypt-file corrupts files'. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> emacsbugs.donarmstrong.com. (Sun, 22 Feb 2009 13:00:03 GMT) Full text and rfc822 format available.

Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Sun, 22 Feb 2009 18:20:03 GMT) Full text and rfc822 format available.

Notification sent to Juri Linkov <juri <at> jurta.org>:
bug acknowledged by developer. (Sun, 22 Feb 2009 18:20:03 GMT) Full text and rfc822 format available.

Message #39 received at 1809-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Andreas Schwab  <schwab <at> linux-m68k.org>
Cc: Juri Linkov <juri <at> jurta.org>, mj <mj54590 <at> gmail.com>,
        Juanma Barranquero <lekktu <at> gmail.com>,
        1809-done <at> debbugs.gnu.org
Subject: Re: bug#1809: decode-coding-inserted-region corrupts files
Date: Sun, 22 Feb 2009 13:15:35 -0500
> 2009-02-22  Andreas Schwab  <schwab <at> linux-m68k.org>
>
>    * insdel.c (del_range_2): Don't modify gap contents when
>      called from decode_coding_object.  (Bug#1809)

Thanks for fixing this bug.




Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Sun, 22 Feb 2009 18:20:03 GMT) Full text and rfc822 format available.

Notification sent to mj <mj54590 <at> gmail.com>:
bug acknowledged by developer. (Sun, 22 Feb 2009 18:20:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Mon, 23 Mar 2009 14:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 95 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.