[PHP-DEV] [PATCH] Check the return value of do_fstat() to avoid error conditions.

2015-01-15 Thread Joshua Rogers
From: Joshua Rogers --- 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

[PHP-DEV] [PATCH] Check the return value of do_fstat() to avoid error conditions.

2015-01-15 Thread Joshua Rogers
--- 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_

Re: [PHP-DEV] [PATCH] Check the return value of do_fstat() to avoid error conditions.

2015-01-15 Thread Joshua Rogers
ere else it is used. Thanks, -- -- Joshua Rogers <https://internot.info/> signature.asc Description: OpenPGP digital signature

[PHP-DEV] [PATCH] Fixed bug #68839 Possible null pointer dereference

2015-01-15 Thread Joshua Rogers
--- ext/phar/zip.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ext/phar/zip.c b/ext/phar/zip.c index 2a95580..2117b0e 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -1217,7 +1217,9 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, zend_long

Re: [PHP-DEV] [PATCH] Fixed bug #68839 Possible null pointer dereference

2015-01-15 Thread Joshua Rogers
;, entry->filename, phar->fname); 920return NULL; 921} --snip-- Should the patch, perhaps be inside the spprintf() function? That would take care of future problems, too. Thoughts? Thanks, -- -- Joshua Rogers <https://internot.info/> signature.asc Description: OpenPGP digital signature

Re: [PHP-DEV] [PATCH] Fixed bug #68839 Possible null pointer dereference

2015-01-15 Thread Joshua Rogers
On 16/01/15 03:48, Joshua Rogers wrote: > Should the patch, perhaps be inside the spprintf() function? > That would take care of future problems, too. > > Thoughts? Ok, so, there are many many places where 'error' is not checked against NULL. So I'm going to submit a

[PHP-DEV] [PATCH] Fix null pointer dereference(s) --

2015-01-16 Thread Joshua Rogers
Multiple places 'spprintf' is called with a NULL 'pbuf', which passes itself to vspprintf, which dereferences it. Although most places check whether 'pbuf'(normally called 'error') is null, it is smarter to check it inside the function that requires a non-null value. This will avoid future proble

Re: [PHP-DEV] [PATCH] Fix null pointer dereference(s) --

2015-01-16 Thread Joshua Rogers
0; }? i.e; --snip-- PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list ap) /* {{{ */ { if(!pbuf) { return 0; } smart_string buf = {0}; size_t result; xbuf_format_converter(&buf, 1, format, ap); --snip-

[PHP-DEV] [PATCH] Fix null pointer dereferences

2015-01-16 Thread Joshua Rogers
-- Multiple places 'spprintf' is called with a NULL 'pbuf', which passes itself to vspprintf, which dereferences it. Although most places check whether 'pbuf'(normally called 'error') is null, it is smarter to check it inside the function that requires a non-null value. This will avoid future pr

[PHP-DEV] [PATCH] Fix missing space in previous commit

2015-01-16 Thread Joshua Rogers
--- main/spprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/spprintf.c b/main/spprintf.c index ba12868..5f50d8a 100644 --- a/main/spprintf.c +++ b/main/spprintf.c @@ -845,7 +845,7 @@ PHPAPI size_t vspprintf(char **pbuf, size_t max_len, const char *format, va_list

[PHP-DEV] [PATCH] Fix bug #68711 Remove useless checks. 'num' is unsigned and cannot be <0.

2015-01-16 Thread Joshua Rogers
--- ext/dba/libflatfile/flatfile.c | 28 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c index b5028f5..f640e19 100644 --- a/ext/dba/libflatfile/flatfile.c +++ b/ext/dba/libflatfile/flatfile

[PHP-DEV] Unable to build as of today

2015-01-17 Thread Joshua Rogers
_intl': php_intl.c:(.text+0x1cf): undefined reference to `php_uchar_minit' collect2: error: ld returned 1 exit status Is anybody else getting this? Thanks, -- -- Joshua Rogers <https://internot.info/> signature.asc Description: OpenPGP digital signature

Re: [PHP-DEV] Unable to build as of today

2015-01-17 Thread Joshua Rogers
On 17/01/15 20:38, Joshua Rogers wrote: > This will probably be fixed in a few hours, but I'm unable to build from > master, in the git repo, due to this commit: > https://github.com/php/php-src/commit/ebb60ac7dd179a3bea540d50a7d595010a82a656#diff-fb329ac450d632c19d4cde46b4e9a38eR100

[PHP-DEV] Removal of various checks?

2015-01-17 Thread Joshua Rogers
should the "if (error) {"'s be removed, or should they be added to the expressions that are missing them? Does anybody know whether it would make the running time faster(by nano-seconds) to add the checks against 'error' before the spprintf() is used, or just to let spprint

[PHP-DEV] [PATCH] Fix integer overflow in calender.

2015-01-19 Thread Joshua Rogers
Fix in overflows in conversation functions for calendar. Add tests for the overflows. --- ext/calendar/calendar.c| 2 +- ext/calendar/gregor.c | 2 +- ext/calendar/julian.c | 2 +- ext/calendar/tests/gregoriantojd_overflo

[PHP-DEV] [PATCH] Fix potential int overflow in date extension.

2015-01-19 Thread Joshua Rogers
--- ext/date/lib/tm2unixtime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/date/lib/tm2unixtime.c b/ext/date/lib/tm2unixtime.c index c058672..94e5254 100644 --- a/ext/date/lib/tm2unixtime.c +++ b/ext/date/lib/tm2unixtime.c @@ -334,9 +334,9 @@ static timelib_sll do

Re: [PHP-DEV] [PATCH] Fix potential int overflow in date extension.

2015-01-19 Thread Joshua Rogers
On 20/01/15 06:15, Joshua Rogers wrote: > -- > ext/date/lib/tm2unixtime.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Somebody please take a look at /ext/date/lib/parse_tz.c too: 438timelib_sll timelib_get_current_offset(timelib_time *t) [..] 446

[PHP-DEV] [PATCH] Remove useless tests

2015-01-20 Thread Joshua Rogers
Respective variables are unsigned and cannot be <0. --- sapi/litespeed/lsapilib.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index 2e60701..20279d1 100644 --- a/sapi/litespeed/lsapilib.c +++ b/sapi/litespeed/

Re: [PHP-DEV] [PATCH] Remove useless tests

2015-01-20 Thread Joshua Rogers
On 21/01/15 05:32, Alexey Zakhlestin wrote: >> > On 20 Jan 2015, at 21:00, Joshua Rogers wrote: >> > >> > Respective variables are unsigned and cannot be <0. > Did you mean to use “==“ in comparisons? > > Yes. Fixed it in the pull request: https

[PHP-DEV] [PATCH] Fix uninitalized variables reads. See CWE-457 for more info.

2015-01-20 Thread Joshua Rogers
--- ext/mbstring/mbstring.c | 8 ext/reflection/php_reflection.c | 1 + main/main.c | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 7f2209f..504a5e6 100644 --- a/ext/mbstring/mbstring

Re: [PHP-DEV] [PATCH] Fix uninitalized variables reads. See CWE-457 for more info.

2015-01-20 Thread Joshua Rogers
On 21/01/15 07:28, Joshua Rogers wrote: > --- > ext/mbstring/mbstring.c | 8 > ext/reflection/php_reflection.c | 1 + > main/main.c | 1 + > 3 files changed, 6 insertions(+), 4 deletions(-) > > diff --git a/ext/mbstring/mbstring.c b/ex

[PHP-DEV] [PATCH 1/3] Fix multiple pieces of code in lsapilib.c.

2015-01-21 Thread Joshua Rogers
--- These issues are not serious(only triggerable by the runner/caller of the PHP program), so no need to make them private. sapi/litespeed/lsapilib.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sapi/litespeed/lsapilib.c b/sapi/litespeed/lsapilib.c index

[PHP-DEV] [PATCH 2/3] Fix null pointer dereference

2015-01-21 Thread Joshua Rogers
--- These issues are not serious(only triggerable by the runner/caller of the PHP program), so no need to make them private. sapi/litespeed/lsapi_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index 2b2385c..d

[PHP-DEV] [PATCH 3/3] Further improvements in litespeed

2015-01-21 Thread Joshua Rogers
--- These issues are not serious(only triggerable by the runner/caller of the PHP program), so no need to make them private. sapi/litespeed/lsapi_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c index d767306..8144706 100644 -

Re: [PHP-DEV] [PATCH 2/3] Fix null pointer dereference

2015-01-21 Thread Joshua Rogers
on it. But, as suggested to me in private, I probably won't be submitting 'smaller' patches such as this one via email, since it just clogs up the emails and wastes bandwidth. Thanks, -- -- Joshua Rogers <https://internot.info/> signature.asc Description: OpenPGP digital signature

Re: [PHP-DEV] [PATCH] Fix uninitalized variables reads. See CWE-457 for more info.

2015-01-22 Thread Joshua Rogers
On 22/01/15 21:36, Yasuo Ohgaki wrote: > > Could you send pull request from github? https://github.com/php/php-src/pull/1012 > It's not required strictly, but if you can includes tests, it would be > great. No tests. It is "undefined behaviour." Thanks,

[PHP-DEV] Error compiling with debug

2015-01-26 Thread Joshua Rogers
f > macro ‘phpdbg_log_ex’ > #define phpdbg_log_ex(out, fmt, ...) > phpdbg_log_internal(PHPDBG_G(io)[PHPDBG_STDOUT].fd, fmt, ##__VA_ARGS__) > > > ^ > /root/php-src/sapi/phpdbg/phpdbg_bp.c:

Re: [PHP-DEV] [PATCH] Fix integer overflow in calender.

2015-01-26 Thread Joshua Rogers
On 27/01/15 11:30, Yasuo Ohgaki wrote: > Hi Joshua, > > Did you send PR or bug report for this? > We need PR or bug report for a bug fix. > Thank you. https://github.com/php/php-src/pull/1009 https://github.com/php/php-src/pull/1008 -- -- Joshua Rogers <https://internot.info/

Re: [PHP-DEV] [PATCH] Check the return value of do_fstat() to avoid error conditions.

2015-01-26 Thread Joshua Rogers
On 27/01/15 11:35, Yasuo Ohgaki wrote: > This patch seems reasonable. Does anyone taking care of this? Perhaps it should be if(do_fstat(data, 1)<0) { return -1; } just to conform with the rest of the code -- -- Joshua Rogers <https://internot.info/> signature.asc Descript

Re: [PHP-DEV] [PATCH] Check the return value of do_fstat() to avoid error conditions.

2015-01-26 Thread Joshua Rogers
On 27/01/15 11:39, Joshua Rogers wrote: > if(do_fstat(data, 1)<0) { > return -1; > } This was wrong, anyways. if '1' is returned, the it is OK to continue. If '0' is returned, it is not OK to continue(return -1) Since this is the case, should the do_fstat funct

Re: [PHP-DEV] [PATCH] Check the return value of do_fstat() to avoid error conditions.

2015-01-26 Thread Joshua Rogers
On 27/01/15 14:32, Joshua Rogers wrote: > if '1' is returned, the it is OK to continue. > If '0' is returned, it is not OK to continue(return -1) > > > Since this is the case, should the do_fstat function be changed to a > boolean? https://github.com/php/p