emacs-devel
[Top][All Lists]
Advanced

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

[PATCH] Add nil check for decoding buffer


From: Lukas Fürmetz
Subject: [PATCH] Add nil check for decoding buffer
Date: Tue, 10 Apr 2018 23:44:22 +0200

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



reply via email to

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