unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add nil check for decoding buffer
@ 2018-04-10 21:44 Lukas Fürmetz
  2018-04-11 17:00 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Lukas Fürmetz @ 2018-04-10 21:44 UTC (permalink / raw)
  To: Emacs Devel

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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-04-13 12:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10 21:44 [PATCH] Add nil check for decoding buffer Lukas Fürmetz
2018-04-11 17:00 ` 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

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).