Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95115 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42886 invoked from network); 13 Aug 2016 13:34:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Aug 2016 13:34:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.21 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.21 mout.gmx.net Received: from [212.227.17.21] ([212.227.17.21:57509] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 14/D0-36656-FF12FA75 for ; Sat, 13 Aug 2016 09:34:56 -0400 Received: from [192.168.2.103] ([79.243.112.54]) by mail.gmx.com (mrgmx101) with ESMTPSA (Nemesis) id 0MbbWD-1borPy2z1Z-00J1y4; Sat, 13 Aug 2016 15:34:51 +0200 To: Nikita Popov References: <85e38ba1-58d4-f8a7-33d4-5f4aa7fce44d@gmx.de> Cc: PHP internals Message-ID: <23d3655e-2686-f3d8-c28a-496b95b33d03@gmx.de> Date: Sat, 13 Aug 2016 15:35:00 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:XR9W0WUamNza2O/VcaZfvlayACYFAdB7iHXawFokifHvUsUUzSQ LTejgnS/cbfptToQnwPauX6x8kOtEoQU2Qn7Yo+S1zTGBbcH1/tMC5/UpT7e+1PcimofXPL pT/B9o91LJFOLu7QdPEPV2/5a2T3MTlfUIsP0G29huzgMJPJy5ih6MkIhLFGD0zwbG4ZN4l EZFs0fupcY78Uj6OLpczg== X-UI-Out-Filterresults: notjunk:1;V01:K0:qucQqrFlg8E=:wkQBjKEr6VL0EERnHDxQfN H3K12zy0waXG4iRJzaatuOKjOORjGtxmnl1pUNImYvpJYzuXXF7qZMdZC4jWjXJ7Oubz+laEt ja2HyMlw7Cfo5nxgi+llJXmYr84eUhIru2etx8Xd97ygRmXB50yanVKHsIU3V22UMjrus+GHh cm3WXV9xstMCo9sitL152DI51vP1QbnSmkmdl+GiaPYXUJaiklENbNpUNuC5QJgn+Md+xDHfM 1VY5botO5SUxvNj6txg3bG3FsRB0QyXCmdUtcq6SUuxEZCNTNdlp8kAiS9mE2IIeH/Oz+wUer 1bZb2wKmwSYAgv/QKIJgjqV1ZvyRJlJaILR88Bo4wseeVO2zMEcKju8+LEgfBcSq6HlKDIchx oPfRj4bZiOETi9RGZty1rZF2fxo1Jgw1SHld7GdxlYjf4Dxnjf0ItEzl1USgybbi19dxgf1bt jMA8l1vd52/6gpTItOGEfGSV9mc2e1rM0A+tkrQyZLirL5mWmueZiB2vCfvnjK2/1MEK0B6qe 0bZ554kKm6cjAyELK0QyrOHuNnhgKqVQxOo3QT4yoHbTPGmLwnZXyZv8V4prtHw4+GwSFjXmM A5Z5hCHoXj4MGzee7dNk6OHxZ0vvXenb9cwM7hytn5nR4nY4r7nNr4jtRg4pAFPmNTWd2KCia ZzwmEvEPWG5bxfOeSk9FaLjlgZ9JR2CY3V6J1eQpgZMUylSG955iylrfkF5XOl9m+gOADKCWF Hh6czttReoZvqlptnKSnJPpSpeO5vsHwpX//Lic8J65WErKT5ZjwDRg4zO8E2g/D62kD+QPTL mnBSNVT Subject: Re: Bug #72828 From: cmbecker69@gmx.de ("Christoph M. Becker") On 13.08.2016 at 15:08, Nikita Popov wrote: > On Sat, Aug 13, 2016 at 2:42 PM, Christoph M. Becker > wrote: > >> You have commented on : >> >> | Unless the allocations explicitly use the system allocator (i.e. do >> | not use emalloc and variants), do NOT introduce NULL checks. >> >> Can you please elaborate, why that shouldn't be done. >> >> Actually, the allocations use safe_emalloc() and emalloc(), >> respectively[1]. However, the only client of the function does >> explicitly check for a NULL return[2], which can only happen, if >> safe_emalloc() fails. So if no NULL checks should be done, this one >> should be removed as well. >> >> [1] >> > standard/string.c#L2926-L2927> >> [2] >> > standard/string.c#L3133-L3134> > > If that's the only failure condition of the function, the check can indeed > be dropped. Fine; I'll do that. > ZMM is an infallible allocator, it will bail out (or abort) if the > allocation fails. The return value should never be checked -- if it is > checked, it's a mistake. Thanks for the explanation! > If you are concerned about USE_ZEND_ALLOC=0 using a fallible allocator, the > system allocator hooks in ZMM should be adjusted to check for NULL and > abort instead (use __zend_malloc instead of malloc, for example). I don't know whether USE_ZEND_ALLOC=0 is in use on any production systems, but if that is so, that should be catered to. And maybe also to zero size allocations, which have implemention defined behavior (either NULL or a valid pointer may be returned). -- Christoph M. Becker