Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95114 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40777 invoked from network); 13 Aug 2016 13:08:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Aug 2016 13:08:06 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.174 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.161.174 mail-yw0-f174.google.com Received: from [209.85.161.174] ([209.85.161.174:36115] helo=mail-yw0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/70-36656-3BB1FA75 for ; Sat, 13 Aug 2016 09:08:04 -0400 Received: by mail-yw0-f174.google.com with SMTP id u134so6181755ywg.3 for ; Sat, 13 Aug 2016 06:08:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KDx8rzzhFvR7+2W5uB8BfI2Esg+FCHz16JR6msaLc/s=; b=KyFZeJ4uiPmUtEkVDtkzGoXSGTqlRP8xzMmMiv7GwenrJh0nnArGc4yrphk9AkfG+5 TIXZnjRXNiiPU3hPFWRlDl/BR2o4NCcEfvcdcCHMlj6kQPDqq45bPiF75ko9eeb0pzR9 5sbLyM5GsV/UABM9Hs9hv0m815mcodTRfoaRSVm2YWe3qq6ZmqvBebV7hTIZrvR34xPV 0Dqp7FmaeeOyd4BfkcsJEq+EOIKyDwbudPFjxWQT0+MhrHGMe6mBwPX1v9INNijd6Ix0 DLpCpS40sUQ2gFkoiBUAhQbgc0OPYnDLtk0nr/Vl8/i2IUULMVLhoUs0OljUAbfrFYgv H4wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KDx8rzzhFvR7+2W5uB8BfI2Esg+FCHz16JR6msaLc/s=; b=JOyXzrZJ+byDkPA5VcWI1/dw5plm6O7UfwW4U4qL1t4cX841gjMLf/znCtz8xuEnlw g+AulAnSlQ7WWdb0oKN1TW/7FJloto4eo+Zcgd7nwTM7Rowr21RO6Lr+lBdy1kk9Cn5A NNIbejWVtSZF1MIrurpcaDZHFAjlKmomGCG6Cr/QwJufIGDz73GHWKm7thS4u/dB3ujk KsiscE4qq/xlGQiww3DIQjcn289UucxbG0ryQEPDuIl9ecLYqOz0qpyi/HBF6MYdOnvd GKMwK7AYw4NSGDgR9EXDcCiDegEXaWpjtOvvwGwQiThPpd2jyqTJDg4ujG1NPcUeEhGN RGEQ== X-Gm-Message-State: AEkoouvJIwaHv/8G4qeONWLqtZuq9q0EAh1yB11SnJekVYwEKEQgMecR3D5h/UIXkrI0PbGBYG8JtyLlHm+tXQ== X-Received: by 10.129.61.13 with SMTP id k13mr13801752ywa.56.1471093681386; Sat, 13 Aug 2016 06:08:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.129.131.129 with HTTP; Sat, 13 Aug 2016 06:08:00 -0700 (PDT) In-Reply-To: <85e38ba1-58d4-f8a7-33d4-5f4aa7fce44d@gmx.de> References: <85e38ba1-58d4-f8a7-33d4-5f4aa7fce44d@gmx.de> Date: Sat, 13 Aug 2016 15:08:00 +0200 Message-ID: To: "Christoph M. Becker" Cc: Nikita Popov , PHP internals Content-Type: multipart/alternative; boundary=001a114281144f7a7b0539f3b0f3 Subject: Re: Bug #72828 From: nikita.ppv@gmail.com (Nikita Popov) --001a114281144f7a7b0539f3b0f3 Content-Type: text/plain; charset=UTF-8 On Sat, Aug 13, 2016 at 2:42 PM, Christoph M. Becker wrote: > Hi Nikita! > > 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. 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. 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). Nikita --001a114281144f7a7b0539f3b0f3--