From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Lukas_F=C3=BCrmetz?= Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] Add nil check for decoding buffer Date: Thu, 12 Apr 2018 17:24:22 +0200 (CEST) Message-ID: <133731674.12774.1523546662700@office.mailbox.org> References: <877epepwi1.fsf@mailbox.org> <83d0z53cfo.fsf@gnu.org> Reply-To: =?UTF-8?Q?Lukas_F=C3=BCrmetz?= NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1523546638 30334 195.159.176.226 (12 Apr 2018 15:23:58 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 12 Apr 2018 15:23:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 12 17:23:53 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1f6e4n-0007kk-FG for ged-emacs-devel@m.gmane.org; Thu, 12 Apr 2018 17:23:53 +0200 Original-Received: from localhost ([::1]:47287 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6e6t-00056Y-Rg for ged-emacs-devel@m.gmane.org; Thu, 12 Apr 2018 11:26:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f6e5g-00052w-1K for emacs-devel@gnu.org; Thu, 12 Apr 2018 11:24:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f6e5e-0004wc-Pm for emacs-devel@gnu.org; Thu, 12 Apr 2018 11:24:47 -0400 Original-Received: from mx2.mailbox.org ([80.241.60.215]:44352) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1f6e5X-0004pT-VL; Thu, 12 Apr 2018 11:24:40 -0400 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 1BE11410D1; Thu, 12 Apr 2018 17:24:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mailbox.org; h= content-transfer-encoding:content-type:content-type:mime-version :subject:subject:references:in-reply-to:message-id:reply-to:from :from:date:date:received; s=mail20150812; t=1523546663; bh=eQzNp mpAKr2UuouG/Su/ruUt+iGho8XlJBPIi4t+wvs=; b=U4meYb8/ukNXlnwP764tx delE4KPCeqbr/Qi8uQJGVLbBJjmizrmEdhWeFftk3DnhR8lvUabZKBAiDtsqQxh8 GwFcfQAIKKpGegGvhudrx5mlfZP9ki7qBiSHRDytsj8jfGBruJ2shbFuTwodU/ur hltkhqu1JN/LJzXdbzgUmSZ4vxr07etZ0bPXV58rfIvWHUkeR52XHaRcfhgy2YvW KcavUXxb7zNxmthbCKpVZZhWh3LjYz7pqL7IJIcYBPoAPndNCyoZ3tr33U/DZESe +2XJ/91qSHScn7zCoLXpdCRLnuri1j7osuyAJmGxcZz0guMZnZdC90TD2OnkFHY9 g== X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id ZBQJbjVuegT8; Thu, 12 Apr 2018 17:24:23 +0200 (CEST) In-Reply-To: <83d0z53cfo.fsf@gnu.org> X-Priority: 3 Importance: Medium X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 80.241.60.215 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:224524 Archived-At: It was definitly a pipe process (cquery (github.com/cquery-project/cquery) = via lsp-mode). I have a reproducable workspace, but I cannot share it. The crash happens, = when stdout is split exactly between a windows newline, so between \r and \n. Maybe I have time to debug it again tomorrow. Otherwise, I'll try to reprod= uce the problem in another way.. > Eli Zaretskii hat am 11. April 2018 um 19:00 geschrieben: >=20 >=20 > > From: Lukas F=C3=BCrmetz > > Date: Tue, 10 Apr 2018 23:44:22 +0200 > >=20 > > 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. > >=20 > > Would be nice, if this is backported to emacs-26.. > >=20 > > Best regards, > > Lukas > >=20 > > --- > > src/process.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > >=20 > > 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_P= rocess *p, char *chars, > >=20 > > 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)) > > =09pset_decoding_buf (p, make_uninit_string (coding->carryover_bytes))= ; > > memcpy (SDATA (p->decoding_buf), coding->carryover, > > =09 coding->carryover_bytes); >=20 > Thanks, but I don't think this is the right fix for the problem. > Every process object must have an associated decoding_buf, so if some > process doesn't, it's a bug in that process's creation code. My > reading of the code is that all the process types we support have > decoding_buf defined during creation -- except one: make-pipe-process > fails to do that. So the fix should be in make-pipe-process. >=20 > Is the problem reproducible, or do you remember what you did when it > happened? I'd like to make sure that indeed some pipe process was > involved in the crash, because otherwise I don't see how it could > happen.