unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sergei Litvin <litvindev@gmail.com>
To: 24064@debbugs.gnu.org
Subject: bug#24064: 24.5; NULL pointer dereference in compute_motion(), indent.c
Date: Tue, 26 Jul 2016 01:02:27 +0300	[thread overview]
Message-ID: <3092bb3f-6d7f-0495-bf53-a317b9f52fa9@gmail.com> (raw)
In-Reply-To: <83vaztu1n5.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1363 bytes --]

I've prepared an elisp file to reproduce a crash:

1) Open it and move cursor to the end of the file

2) Execute eval-buffer

3) Press C-l several times


Sergei Litvin


On 07/25/2016 07:24 PM, Eli Zaretskii wrote:
>> From: Sergei Litvin <litvindev@gmail.com>
>> Date: Mon, 25 Jul 2016 02:51:40 +0300
>>
>>
>> struct position *
>> compute_motion (ptrdiff_t from, ptrdiff_t frombyte, EMACS_INT fromvpos,
>> EMACS_INT fromhpos, bool did_motion, ptrdiff_t to,
>> EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width,
>> ptrdiff_t hscroll, int tab_offset, struct window *win)
>> {
>>
>> ...
>>
>> if (dp == buffer_display_table ())
>> width_table = (VECTORP (BVAR (current_buffer, width_table))
>> ? XVECTOR (BVAR (current_buffer, width_table))->contents
>> : 0);
>> else
>> /* If the window has its own display table, we can't use the width
>> run cache, because that's based on the buffer's display table. */
>> width_table = 0; // initialize it with 0 (current buffer has no display table)
>>
>> ...
>>
>> if (width_cache)
>> {
>> /* Is this character part of the current run? If so, extend
>> the run. */
>> if (pos - 1 == width_run_end
>> && XFASTINT (width_table[c]) == width_run_width) // dereference width_table here, and crash
>> width_run_end = pos;
> Did you actually see such a crash, and if so, can you show a recipe
> for reproducing that?
>
> Thanks.


[-- Attachment #2: emacs-crash.el --]
[-- Type: text/x-emacs-lisp, Size: 470 bytes --]

(set-window-display-table (selected-window) #^[nil nil display-table nil nil nil nil nil nil nil nil nil nil nil
 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
 nil nil nil nil nil nil nil nil nil])
(set-buffer-multibyte nil)
; 1) Move cursor to this line
; 2) Execute eval-buffer
; 3) Press C-l several times

  reply	other threads:[~2016-07-25 22:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-24 23:51 bug#24064: 24.5; NULL pointer dereference in compute_motion(), indent.c Sergei Litvin
2016-07-25 16:24 ` Eli Zaretskii
2016-07-25 22:02   ` Sergei Litvin [this message]
2016-07-25 22:37     ` Clément Pit--Claudel
2016-07-26  2:33       ` npostavs
2016-07-26  2:49         ` Clément Pit--Claudel
2016-07-26 15:35           ` Eli Zaretskii
2016-07-26 16:04             ` Clément Pit--Claudel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3092bb3f-6d7f-0495-bf53-a317b9f52fa9@gmail.com \
    --to=litvindev@gmail.com \
    --cc=24064@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).