Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7191 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5376 invoked by uid 1010); 19 Jan 2004 20:41:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 5317 invoked from network); 19 Jan 2004 20:41:29 -0000 Received: from unknown (HELO smtp2.netcologne.de) (194.8.194.218) by pb1.pair.com with SMTP; 19 Jan 2004 20:41:29 -0000 Received: from localhost.localdomain (xdsl-213-168-116-236.netcologne.de [213.168.116.236]) by smtp2.netcologne.de (Postfix) with SMTP id 652F939D2B for ; Mon, 19 Jan 2004 21:41:28 +0100 (MET) Date: Mon, 19 Jan 2004 21:41:28 +0100 To: internals@lists.php.net Message-ID: <20040119214128.4bbeec5a.paj@pearfr.org> Organization: Freelancer X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.10; i586-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Mon__19_Jan_2004_21_41_28_+0100_RxyMTTB/.+P8U9Oz" Subject: CLI segfault, in sapi_cli_single_write From: paj@pearfr.org (Pierre-Alain Joye) --Multipart=_Mon__19_Jan_2004_21_41_28_+0100_RxyMTTB/.+P8U9Oz Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Hello, I got a segfault in sapi_cli_single_write. For an (yet) unknown reason, str becomes empty. The attached patch fixes it. sidenote: found it by trying to resolve huge segfault in dom_xpath_query pierre --Multipart=_Mon__19_Jan_2004_21_41_28_+0100_RxyMTTB/.+P8U9Oz Content-Type: text/plain; name="php_cli.txt" Content-Disposition: attachment; filename="php_cli.txt" Content-Transfer-Encoding: 7bit Index: sapi/cli/php_cli.c =================================================================== RCS file: /repository/php-src/sapi/cli/php_cli.c,v retrieving revision 1.107 diff -u -p -r1.107 php_cli.c --- sapi/cli/php_cli.c 14 Jan 2004 03:14:17 -0000 1.107 +++ sapi/cli/php_cli.c 19 Jan 2004 20:38:16 -0000 @@ -189,6 +189,10 @@ static inline size_t sapi_cli_single_wri #else size_t ret; + if (!str) { + return 0; + } + ret = fwrite(str, 1, MIN(str_length, 16384), stdout); return ret; #endif --Multipart=_Mon__19_Jan_2004_21_41_28_+0100_RxyMTTB/.+P8U9Oz--