emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC on proposal fix [Re: Crash caused by insert-file-contents, both


From: Eli Zaretskii
Subject: Re: RFC on proposal fix [Re: Crash caused by insert-file-contents, both trunk (bzr 111532) and 24.2.92 affected]
Date: Fri, 18 Jan 2013 21:34:26 +0200

> Date: Thu, 17 Jan 2013 22:12:24 +0400
> From: Dmitry Antipov <address@hidden>
> Cc: address@hidden
> 
> On 01/17/2013 09:50 PM, Eli Zaretskii wrote:
> 
> > Can you tell which problems you found in the original code that these
> > changes are supposed to fix?
> 
> 1) Original code do emacs_read to ((char *) BEG_ADDR + PT_BYTE - BEG_BYTE + 
> offset
>     without adjusting gap size, z and zv; this (IIUC) fools make_gap and so
>     enlarge_buffer_text; we end up with the gap which is less than expected,
>     read_non_regular do emacs_read into the buffer beyond allocated buffer 
> text,
>     which finally causes EFAULT from emacs_read or heap corruption.

I'm not sure I see how the gap size fails to be updated.  There's a
call to make_gap just before read_non_regular is called.  Or did you
mean GAP_SIZE?  If the latter, then the comments there explain why
this is not done.

> 2) Original code throws I/O error too early without decoding the data possibly
>     read before. When not-yet-decoded part of buffer text is displayed, 
> redisplay
>     is likely to crash.

But until GAP_SIZE and ZV are updated, the inserted text is not
really part of the buffer, right?  So what is the problem here?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]