From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19172 invoked by alias); 28 Nov 2016 13:43:13 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 40025 Received: (qmail 998 invoked from network); 28 Nov 2016 13:43:13 -0000 X-Qmail-Scanner-Diagnostics: from mx2.imag.fr by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(129.88.30.17):SA:0(-5.3/5.0):. Processed in 4.24922 secs); 28 Nov 2016 13:43:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-5.3 required=5.0 tests=RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: raphael.jakse@imag.fr X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at imag.fr designates 129.88.30.17 as permitted sender) From: =?UTF-8?Q?Rapha=c3=abl_Jakse?= Subject: [PATCH] Fix #87 - Segfault fault when autocompleting after ">" in, "!> ." To: zsh-workers@zsh.org Message-ID: <53d2b131-bca8-b968-bf46-fa4e4d801231@imag.fr> Date: Mon, 28 Nov 2016 14:06:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------8F5C0A917C2B47A89249D72A" X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (mx2.imag.fr [129.88.30.17]); Mon, 28 Nov 2016 14:06:54 +0100 (CET) X-IMAG-MailScanner-Information: Please contact MI2S MIM for more information X-MailScanner-ID: uASD6rjY006655 X-IMAG-MailScanner: Found to be clean X-IMAG-MailScanner-SpamCheck: X-IMAG-MailScanner-From: raphael.jakse@imag.fr MailScanner-NULL-Check: 1480943214.15187@mWGPB+9vIZNzOxpRGMzjFw --------------8F5C0A917C2B47A89249D72A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Dear zsh developers, Bug #87 in the SF bug tracker (which is not used anymore if I understood correctly) claims that when hitting tab to complete after '>' in the string "!> cmake ..", zsh crashes. I could reproduce the bug that also appears with the string "!> .". Here is a patch that works around this bug by checking whether s is null in the get_comp_string function (zle_tricky.c) before a code that seems to assume that s is not null. The get_comp_string function is full of warnings like "abandon all hopes" and "This function is a nightmare" so I didn't try to know whether s being null at this point is correct. It is unclear to me how to send a patch for zsh so please let me know if something is wrong or if additional steps are necessary to apply this patch. Best, Raphaƫl --------------8F5C0A917C2B47A89249D72A Content-Type: text/x-patch; name="fix-completion-segfault.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="fix-completion-segfault.patch" >>From ced2387dc8dc65aecc34ecde29924810126a48be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Jakse?= Date: Fri, 25 Nov 2016 17:14:39 +0100 Subject: [PATCH] Fix #87 - Segfault when autocompleting after ">" in "!> ." The fix is a workaround that checks whether s is null in the get_comp_string function (zle_tricky.c) before a code that seems to assume that s is not null get_comp_string. --- Src/Zle/zle_tricky.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c index c8d3bb3..18ec47a 100644 --- a/Src/Zle/zle_tricky.c +++ b/Src/Zle/zle_tricky.c @@ -1518,7 +1518,7 @@ get_comp_string(void) zlemetaline = tmp; zlemetall = strlen(zlemetaline); } - if (t0 != STRING && t0 != TYPESET && inwhat != IN_MATH) { + if (!s || (t0 != STRING && t0 != TYPESET && inwhat != IN_MATH)) { if (tmp) { tmp = NULL; linptr = zlemetaline; -- 2.9.3 --------------8F5C0A917C2B47A89249D72A--