From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23558 invoked by alias); 20 Oct 2016 09:33:10 -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: 39683 Received: (qmail 1658 invoked from network); 20 Oct 2016 09:33:10 -0000 X-Qmail-Scanner-Diagnostics: from mailout3.w1.samsung.com 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(210.118.77.13):SA:0(-0.3/5.0):. Processed in 0.480214 secs); 20 Oct 2016 09:33:10 -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=-0.3 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts) X-AuditID: cbfec7f1-f79f46d0000008eb-aa-58088f4e0049 Date: Thu, 20 Oct 2016 10:32:59 +0100 From: Peter Stephenson To: Zsh hackers list Subject: Re: Cores almost on demand in patcompile() Message-id: <20161020103259.0b0fe556@pwslap01u.europe.root.pri> In-reply-to: Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLIsWRmVeSWpSXmKPExsWy7djPc7p+/RwRBivecFscbH7I5MDoserg B6YAxigum5TUnMyy1CJ9uwSujPPLr7AVPOGpaD9zgqmBsYGzi5GTQ0LAROLXtl9MELaYxIV7 69m6GLk4hASWMkq8uXaHFcLpZZJoOP2NFabjx5oNUIlljB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B9pLzLxyBqpZUOLH5HssIDYz0ILN25pYIWx5ic1r3jKD2EIC6hI37u5mn8AoPAtJyywk LbOQtCxgZF7FKJJaWpybnltsqFecmFtcmpeul5yfu4kRGEnbjv3cvIPx0sbgQ4wCHIxKPLwW rRwRQqyJZcWVuYcYJTiYlUR4L9QDhXhTEiurUovy44tKc1KLDzGaAkNmIrOUaHI+MMrzSuIN TQzNLQ2NjC0szI2MlMR5Sz5cCRcSSE8sSc1OTS1ILYLpY+LglGpgrJJYuuoG6/4zmbk3ajad +JU88e/T4C1eX5j5PVdem3L5v/P6qyLhomm5h/lCzQXfCX2YdrmG7/WnKTM271G2K/Oxi1np /tczrHVi6rF9izzZcmI+RYXt27itjunRd0O1b4eT5qi1x/XmhPVPZ19etWoJ/79rTPoTokIi bbLl3L/q9Z+yZtXyV2Ipzkg01GIuKk4EANoZN4C6AgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161020093301eucas1p1f908a7bff2788cf9f418982b20f5d66c X-Msg-Generator: CA X-Sender-IP: 182.198.249.179 X-Local-Sender: =?UTF-8?B?UGV0ZXIgU3RlcGhlbnNvbhtTQ1NDLURhdGEgUGxhbmUb?= =?UTF-8?B?7IK87ISx7KCE7J6QG1ByaW5jaXBhbCBFbmdpbmVlciwgU29mdHdhcmU=?= X-Global-Sender: =?UTF-8?B?UGV0ZXIgU3RlcGhlbnNvbhtTQ1NDLURhdGEgUGxhbmUbU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtQcmluY2lwYWwgRW5naW5lZXIsIFNvZnR3YXJl?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDA1Q0QwNTAwNTg=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20161011044403eucas1p1da8d4beef07f15ef1fb7e821eab83152 X-RootMTR: 20161011044403eucas1p1da8d4beef07f15ef1fb7e821eab83152 References: <20161013104321.29159e3f@pwslap01u.europe.root.pri> <20161019141435.42eb6df2@pwslap01u.europe.root.pri> On Thu, 20 Oct 2016 07:55:13 +0200 Sebastian Gniazdowski wrote: > Valgrind outputs two "Invalid read of size 8" messages. Don't know why > there are no line pointers to source, however the reads are in > patcompile(). I'm afraid that are PATNEXT invocations, final > segmentation-fault places. Thanks, I think we're getting somewhere. Yes, I think the actual problem is in the block where you've been adding the debugging. It's the same one Bart noted when he managed to get this to show up with the line numbers. I think this: if (nmeta) { char *oldpatout = patout; patadd(NULL, 0, nmeta, 0); /* * Yuk. */ p = (Patprog)patout; opnd = patout + (opnd - oldpatout); dst = patout + startoff; } can have an effect on where pscan should be pointing because of the reallocation. A better way of doing this would be loop first to count the space needed then allocate it. See if this helps (I think next is the key one to update): diff --git a/Src/pattern.c b/Src/pattern.c index 4e2f236..158bfd5 100644 --- a/Src/pattern.c +++ b/Src/pattern.c @@ -669,12 +669,16 @@ patcompile(char *exp, int inflags, char **endexp) nmeta++; if (nmeta) { char *oldpatout = patout; + ptrdiff_t pd; patadd(NULL, 0, nmeta, 0); /* * Yuk. */ p = (Patprog)patout; - opnd = patout + (opnd - oldpatout); + pd = patout - oldpatout; + opnd += pd; + pscan += pd; + next += pd; dst = patout + startoff; } pws