Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80526 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51914 invoked from network); 15 Jan 2015 10:50:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Jan 2015 10:50:04 -0000 Authentication-Results: pb1.pair.com header.from=laruence@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=xinchen.h@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.217.180 as permitted sender) X-PHP-List-Original-Sender: xinchen.h@zend.com X-Host-Fingerprint: 209.85.217.180 mail-lb0-f180.google.com Received: from [209.85.217.180] ([209.85.217.180:53291] helo=mail-lb0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 61/C5-14306-A5B97B45 for ; Thu, 15 Jan 2015 05:50:03 -0500 Received: by mail-lb0-f180.google.com with SMTP id f15so3038065lbj.11 for ; Thu, 15 Jan 2015 02:49:59 -0800 (PST) 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:content-type; bh=exGArXcLHbmbNNP63R5WhVXq4QX+1p1f6//MA8/7ihQ=; b=LAmshVfsliarB528zhtXyJsGeMhYZa0xcpqkIVd9j8NPSmlChHGH8UaJ8jvqmCneEB m6ck2pFBiriOJuYsR2M9rmOhaREtCiV9aqTLT4mcKUjSOtWEa8xf04q9+FpnTb8X2Zyq OoGcCn+h5cKuiqNOtabtdH/AjHVi795GhT8e6UP5sLYJs0eqZA82z0YM53Ue5AO06WP/ K0sndZgMbhE9/P6eywESECoNCmpoHksDTkeOICpF1Fj75zrg7v2jc8wtzsqEBP6xcYZg EgBNyU/EJ+lJUAvzmtY0imwH148kLH0DH3EqBBuhE/285pp42UpKYvLBIFHrdlKiJwLX Dmog== X-Gm-Message-State: ALoCoQmBmwGnXZM6SHNfE2UchoS+YK4ZupSdapN6p7mfXQuaF3IWBKUB20toq0pJNt1tqXKOqGza/7RxgZDouMgZkV3PA6F034Qic4hSwCAYGUxlUK5v1vsOA7k1JIF2BnZoCOTkrJA56uVQQ+SwaptA4l+EqPpEWg== X-Received: by 10.112.148.73 with SMTP id tq9mr8949772lbb.37.1421318999376; Thu, 15 Jan 2015 02:49:59 -0800 (PST) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com. [209.85.217.180]) by mx.google.com with ESMTPSA id vl1sm459229lbb.21.2015.01.15.02.49.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Jan 2015 02:49:57 -0800 (PST) Received: by mail-lb0-f180.google.com with SMTP id f15so3037928lbj.11 for ; Thu, 15 Jan 2015 02:49:57 -0800 (PST) X-Received: by 10.112.64.35 with SMTP id l3mr8915032lbs.82.1421318997299; Thu, 15 Jan 2015 02:49:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.114.64.176 with HTTP; Thu, 15 Jan 2015 02:49:37 -0800 (PST) In-Reply-To: <1421308977-9413-1-git-send-email-git@internot.info> References: <1421308977-9413-1-git-send-email-git@internot.info> Date: Thu, 15 Jan 2015 18:49:37 +0800 Message-ID: To: Joshua Rogers Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [PATCH] Check the return value of do_fstat() to avoid error conditions. From: laruence@php.net (Xinchen Hui) Hey: On Thu, Jan 15, 2015 at 4:02 PM, Joshua Rogers wrote: > --- > main/streams/plain_wrapper.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c > index f52383d..72be0b0 100644 > --- a/main/streams/plain_wrapper.c > +++ b/main/streams/plain_wrapper.c > @@ -669,7 +669,8 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void > return fd == -1 ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK; > > case PHP_STREAM_MMAP_MAP_RANGE: > - do_fstat(data, 1); > + if(do_fstat(data, 1)<0) > + return -1; > if (range->length == 0 && range->offset > 0 && range->offset < data->sb.st_size) { > range->length = data->sb.st_size - range->offset; > } > -- > 1.9.1 > do you have a test script to show how to reproduce the error? thanks > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Xinchen Hui @Laruence http://www.laruence.com/