From: "Lukas Fürmetz" <fuermetz@mailbox.org>
To: Emacs Devel <emacs-devel@gnu.org>
Subject: [PATCH] Add nil check for decoding buffer
Date: Tue, 10 Apr 2018 23:44:22 +0200 [thread overview]
Message-ID: <877epepwi1.fsf@mailbox.org> (raw)
Hello,
This patch prevents a emacs crash under Windows for me. Sometimes the
buffer is split between \r\n and the \n is carried over, but the
decoding_buf is NIL, so "SCHARS (p->decoding_buf)" leads to a SEGFAULT.
Would be nice, if this is backported to emacs-26..
Best regards,
Lukas
---
src/process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/process.c b/src/process.c
index c357a8bdc3..ab2e6ce4da 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5996,7 +5996,7 @@ read_and_dispose_of_process_output (struct Lisp_Process *p, char *chars,
if (coding->carryover_bytes > 0)
{
- if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
+ if (NILP (p->decoding_buf) || (SCHARS (p->decoding_buf) < coding->carryover_bytes))
pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes));
memcpy (SDATA (p->decoding_buf), coding->carryover,
coding->carryover_bytes);
--
2.17.0
next reply other threads:[~2018-04-10 21:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-10 21:44 Lukas Fürmetz [this message]
2018-04-11 17:00 ` [PATCH] Add nil check for decoding buffer Eli Zaretskii
2018-04-12 15:24 ` Lukas Fürmetz
2018-04-12 15:29 ` Eli Zaretskii
2018-04-12 15:34 ` Lukas Fürmetz
2018-04-12 16:24 ` Eli Zaretskii
2018-04-13 8:47 ` Lukas Fürmetz
2018-04-13 12:49 ` Eli Zaretskii
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=877epepwi1.fsf@mailbox.org \
--to=fuermetz@mailbox.org \
--cc=emacs-devel@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.