Subject: bug#1809: decode-coding-inserted-region corrupts files

From: Juanma Barranquero <[email-masked]>
Date: Fri, 16 Jan 2009 00:35:19 +0100

On Fri, Jan 16, 2009 at 00:02, Juri Linkov <[email-masked]> 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