Newsgroups: php.internals,php.pecl.dev Path: news.php.net Xref: news.php.net php.internals:63524 php.pecl.dev:9907 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63642 invoked from network); 18 Oct 2012 10:45:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Oct 2012 10:45:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-ia0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:53220] helo=mail-ia0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/38-30095-0EDDF705 for ; Thu, 18 Oct 2012 06:45:52 -0400 Received: by mail-ia0-f170.google.com with SMTP id e16so7148483iaa.29 for ; Thu, 18 Oct 2012 03:45:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Tp5BJNCzfTcOYr7XocACVb1qQQzPllaD1Q+OcO1QoCE=; b=pOndgLLGphyPiTesdWMpizp406o6MulyKxblNZZw17V34iV9jOJeHYpWG5WwuGpH1T QoYbUnEKgPQK3Uub+G7JuUiLD1IMxS0Je2MTyU7tDT9nEHm130EBF6xTHo5kL6Fz10r5 /Z9kZJSlnsLmrHGL14huENIYzUk2bO+PBxzJOs+jukdthyDrnRO2gzp1BppdAwPXJq+i 8gYlI6gDAF3p1kufK6B2y1YWt2O+WlE/DqAhzjGuRXJQJVuXSSkNsAiUt3LnZjINB0/Z goBDBqQXA6HFVqLmxsZqEBHtMRDBH9hxKsUb3WwTxDezzjZ5N2O2wdAJN6M75pBvq7mW XwAQ== MIME-Version: 1.0 Received: by 10.50.91.195 with SMTP id cg3mr4282927igb.57.1350557149268; Thu, 18 Oct 2012 03:45:49 -0700 (PDT) Received: by 10.64.33.143 with HTTP; Thu, 18 Oct 2012 03:45:49 -0700 (PDT) In-Reply-To: References: Date: Thu, 18 Oct 2012 12:45:49 +0200 Message-ID: To: Laruence Cc: PHP Internals , PECL Announce , Dmitry Stogov , Dmitry Stogov Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Please do not call zval_dtor on recursive array From: pierre.php@gmail.com (Pierre Joye) hi Dmitry, Laruence! On Thu, Oct 18, 2012 at 11:46 AM, Laruence wrote: > Hey: > > recently we found a problem, that is "usage zval_dtor on a recursive > array while gc enabled" has chance to result a segfault. > > a reproduce script could be found here: > https://github.com/php/php-src/blob/8bd5e15ff7a57791956c4017ee8fb4a8ac0d8d2e/ext/pcre/tests/bug63055.phpt > > the preg_match used to call zval_dtor on the third argument. which > result a segfault, reported at #63055 > > the segfault backtrace will looks like: http://pastebin.com/uPWBgrTZ > > thanks to dmitry, we got a simple solution, that is: instead of > directly call to zval_dtor, please use following codes instead: > " > zval garbage = *subpats; > array_init(subpats); > zval_dtor(&garbage); > " Nice catch! We could add a macro? As it looks like many will forget to do that :) Cheers, -- Pierre @pierrejoye | http://blog.thepimp.net | http://www.libgd.org