Mailinglist Archive: opensuse-commit (1942 mails)

< Previous Next >
commit php5
  • From: root@xxxxxxxxxxxxxxx (h_root)
  • Date: Mon, 17 Nov 2008 18:00:00 +0100
  • Message-id: <20081117170000.910DD678166@xxxxxxxxxxxxxxx>

Hello community,

here is the log from the commit of package php5
checked in at Mon Nov 17 18:00:00 CET 2008.


--------
--- php5/php5.changes 2008-09-08 11:23:45.000000000 +0200
+++ /mounts/work_src_done/STABLE/php5/php5.changes 2008-11-12
21:25:02.000000000 +0100
@@ -1,0 +2,31 @@
+Wed Nov 12 21:24:00 CET 2008 - crrodriguez@xxxxxxx
+
+- fix ext/imap buffer overflows, old API used [#BNC402665]
+
+-------------------------------------------------------------------
+Wed Nov 12 17:10:50 CET 2008 - crrodriguez@xxxxxxx
+
+- QA Results fixed
+ * array_pad "succeeds" when padding with large negative number [BNC#435595]
+
+-------------------------------------------------------------------
+Wed Nov 12 16:10:52 CET 2008 - crrodriguez@xxxxxxx
+
+- QA Results: fix PPC64 regression of gd module [BNC#364518]
+
+-------------------------------------------------------------------
+Wed Nov 12 16:01:51 CET 2008 - crrodriguez@xxxxxxx
+
+- update system timezone support patch to r4
+ * added "System/Localtime" tzname which uses /etc/localtime
+
+-------------------------------------------------------------------
+Thu Oct 9 06:30:03 CEST 2008 - crrodriguez@xxxxxxx
+
+- Using the ArrayObject class leaks and corrupt memory,
+ causing a really nasty undefined behaviour in userspace code, whatever
+ can happend due to corruption of the symbol table.
+ see http://bugs.php.net/bug.php?id=46222 where martian variables
+ get created as example.
+
+-------------------------------------------------------------------

calling whatdependson for head-i586


Old:
----
php-5.2.5-system-tzdb.patch

New:
----
php-5.2.6-arrayobject-mess.patch
php-5.2.6-bnc-435595.patch
php-5.2.6-CVE-2008-2829.patch
php-5.2.6-qa-ppc64-bug24155.patch
php-5.2.6-systzdata.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ php5.spec ++++++
--- /var/tmp/diff_new_pack.i20310/_old 2008-11-17 17:58:42.000000000 +0100
+++ /var/tmp/diff_new_pack.i20310/_new 2008-11-17 17:58:42.000000000 +0100
@@ -84,7 +84,7 @@
###
###
Version: 5.2.6
-Release: 45
+Release: 49
License: The PHP License, version 3.01
Group: Development/Languages/Other
Provides: php zend php-xml php-spl php-simplexml php-session php-pcre
php-date php-reflection php-filter
@@ -113,13 +113,17 @@
%if %{with_suhosin_patch}
Patch6: suhosin-patch-%{version}-%{suhosin_patch_version}.patch.gz
%endif
-Patch7: php-5.2.5-system-tzdb.patch
+Patch7: php-5.2.6-systzdata.patch
#bugs
# compiler warnings
Patch9: php5-warnings.patch
Patch10: php5-zend.patch
Patch11: php5-alignment.patch
+Patch12: php-5.2.6-arrayobject-mess.patch
+Patch13: php-5.2.6-qa-ppc64-bug24155.patch
+Patch14: php-5.2.6-bnc-435595.patch
#please use patch30 and up for security fixes
+Patch30: php-5.2.6-CVE-2008-2829.patch
Url: http://www.php.net
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Summary: PHP5 Core Files
@@ -146,8 +150,6 @@
Group: Development/Languages/C and C++
#this is required by the installed development headers
Requires: %{name} = %{version} glibc-devel libxml2-devel
-#this is needed for "pecl" functionality
-Requires: autoconf automake
# 5.2.2 or later installs php_pcre.h that requires pcre-devel
%if 0%{?suse_version} > 1010
Requires: pcre-devel
@@ -192,7 +194,7 @@
See http://www.php.net/credits.php for more details

%package -n apache2-mod_php5
-License: Other uncritical OpenSource License
+License: Other uncritical OpenSource License; The PHP License, version
3.1. See package php5 for the full text.
Summary: PHP5 Module for Apache 2.0
Group: Productivity/Networking/Web/Servers
Requires: apache2-prefork %{apache2_mmn} %{name} = %{version}
@@ -1195,10 +1197,15 @@
%if %{with_suhosin_patch}
%patch6 -p1
%endif
-%patch7
+%patch7 -p1
%patch9
%patch10
%patch11
+%patch12
+%patch13
+%patch14
+#secfixes
+%patch30
# we build three SAPI
%{__mkdir_p} build-apache2
%{__mkdir_p} build-fastcgi/sapi/cgi/libfcgi
@@ -1889,6 +1896,22 @@
%config(noreplace) %{php_sysconf}/conf.d/zlib.ini

%changelog
+* Wed Nov 12 2008 crrodriguez@xxxxxxx
+- fix ext/imap buffer overflows, old API used [#BNC402665]
+* Wed Nov 12 2008 crrodriguez@xxxxxxx
+- QA Results fixed
+ * array_pad "succeeds" when padding with large negative number [BNC#435595]
+* Wed Nov 12 2008 crrodriguez@xxxxxxx
+- QA Results: fix PPC64 regression of gd module [BNC#364518]
+* Wed Nov 12 2008 crrodriguez@xxxxxxx
+- update system timezone support patch to r4
+ * added "System/Localtime" tzname which uses /etc/localtime
+* Thu Oct 09 2008 crrodriguez@xxxxxxx
+- Using the ArrayObject class leaks and corrupt memory,
+ causing a really nasty undefined behaviour in userspace code, whatever
+ can happend due to corruption of the symbol table.
+ see http://bugs.php.net/bug.php?id=46222 where martian variables
+ get created as example.
* Mon Sep 08 2008 crrodriguez@xxxxxxx
- update suhosin to version 0.9.27
* Fixed problem with suhosin.perdir
@@ -2139,7 +2162,7 @@
- fixed the dba extension adding -ldb-4.x to global LDFLAGS,
causing unnecessary dependency in /usr/bin/php5
[http://bugs.php.net/bug.php?id=41455]
-* Sun May 20 2007 judas_iscariote@xxxxxxxxxxxxx
+* Sat May 19 2007 judas_iscariote@xxxxxxxxxxxxx
- updated suhosin to version 0.9.20, security fix + bugfixes
see http://www.hardened-php.net/suhosin/changelog.html for more detail.
* Mon May 14 2007 judas_iscariote@xxxxxxxxxxxxx
@@ -2151,7 +2174,7 @@
- use rpm macros in the spec file
- when removing apache2-mod_php5, unload it from apache first.
- when updating apache2-mod_php5 restart apache with restart on update macro.
-* Mon May 07 2007 judas_iscariote@xxxxxxxxxxxxx
+* Sun May 06 2007 judas_iscariote@xxxxxxxxxxxxx
- HTTP_RAW_POST_DATA superglobal broken (php5-phpbug-41293.patch)
- better fix for MOPB 41.
* Sat May 05 2007 judas_iscariote@xxxxxxxxxxxxx
@@ -2284,7 +2307,7 @@
- updated suhosin to 0.9.9
* Fri Oct 20 2006 nadvornik@xxxxxxx
- update to 5.2.0RC6
-* Fri Oct 20 2006 postadal@xxxxxxx
+* Thu Oct 19 2006 postadal@xxxxxxx
- reset right path in extension_dir (php5-php-config.patch)
* Mon Oct 09 2006 postadal@xxxxxxx
- update to version 5.2.0RC5
@@ -2495,7 +2518,7 @@
- 64bit fixes
* Thu Jan 19 2006 postadal@xxxxxxx
- disable discard-path for fastcgi binary [#143564]
-* Thu Jan 19 2006 postadal@xxxxxxx
+* Wed Jan 18 2006 postadal@xxxxxxx
- updated to version 5.1.2
- removed obsoleted patches: CAN-2005-1042_1043.patch, CVE-2005-3353.patch,
openssl.patch, soap.patch, pdo.patch, simplexml.patch, curl.patch,
@@ -2532,7 +2555,7 @@
* Thu Dec 15 2005 mmarek@xxxxxxx
- provide php-pear in php5-pear
- add /usr/share/php5/PEAR to include path
-* Wed Dec 07 2005 postadal@xxxxxxx
+* Tue Dec 06 2005 postadal@xxxxxxx
- fixed [php#33987] bug (php script as ErrorDocument causes crash
in Apache 2).
* Mon Dec 05 2005 postadal@xxxxxxx
@@ -2693,7 +2716,7 @@
- removed mod_php4 package (mod_php4-core is probably obsolete too)
* Tue May 04 2004 tcrhak@xxxxxxx
- build with postfix instead of sendmail
-* Fri Apr 30 2004 ro@xxxxxxx
+* Thu Apr 29 2004 ro@xxxxxxx
- remove apache1 related parts
* Fri Apr 23 2004 tcrhak@xxxxxxx
- added sendmail to neededforbuild, so that mail() is defined (bug #39153)
@@ -2701,7 +2724,7 @@
* Wed Mar 31 2004 tcrhak@xxxxxxx
- added php module recode (bug #36573)
- fixed requires of mod_php4-apache2 (bug #37041)
-* Tue Mar 23 2004 ro@xxxxxxx
+* Mon Mar 22 2004 ro@xxxxxxx
- build-fix for jakarta-tomcat from skh
- removed apache-contrib from neededforbuild (dropped)
* Tue Mar 16 2004 tcrhak@xxxxxxx
@@ -2718,7 +2741,7 @@
- use jakarta-tomcat4
* Mon Feb 16 2004 ro@xxxxxxx
- use unixODBC instead of iodbc
-* Wed Feb 11 2004 poeml@xxxxxxx
+* Tue Feb 10 2004 poeml@xxxxxxx
- fix symbol exports for apache2
- add -fno-strict-aliasing to CFLAGS, due to code where
dereferencing type-punned pointers would break strict aliasing
@@ -2779,7 +2802,7 @@
- added sysconfig metadata [bug #22604]
* Fri Feb 14 2003 tcrhak@xxxxxxx
- added php3, php4 to DirectoryIndex [bug #22066]
-* Fri Feb 14 2003 ro@xxxxxxx
+* Thu Feb 13 2003 ro@xxxxxxx
- really disable (empty) subpackage servlet
* Wed Feb 12 2003 poeml@xxxxxxx
- rename subpackage mod_php4_2 to apache2-mod_php4
@@ -2829,7 +2852,7 @@
- added type .php3 to apache mod_php4.conf
* Wed Sep 18 2002 ro@xxxxxxx
- removed bogus self-provides
-* Wed Sep 04 2002 tcrhak@xxxxxxx
+* Tue Sep 03 2002 tcrhak@xxxxxxx
- fixed to build on 64 bit archs
* Fri Aug 23 2002 tcrhak@xxxxxxx
- fixed to build on non-i386 archs
@@ -2920,7 +2943,7 @@
- use qt2 for qtdom (but aparently that is not built anyway)
* Thu Oct 25 2001 ro@xxxxxxx
- try neededforbuild alias apache-devel-packages
-* Tue Sep 11 2001 ro@xxxxxxx
+* Mon Sep 10 2001 ro@xxxxxxx
- remove roxen subpackage
roxen is not in the distribution currently
* Wed Aug 22 2001 ro@xxxxxxx
@@ -2970,13 +2993,13 @@
- updated asp2php 0.75.13
- make us of suse_loadmodule for testing
- added /usr/bin/php to core package [BUG#6648]
-* Thu Mar 22 2001 ro@xxxxxxx
+* Wed Mar 21 2001 ro@xxxxxxx
- changed neededforbuild to freetype2
* Thu Mar 15 2001 ro@xxxxxxx
- build with openldap2
* Thu Mar 15 2001 ro@xxxxxxx
- fixed neededforbuild for openldap
-* Tue Mar 06 2001 ro@xxxxxxx
+* Mon Mar 05 2001 ro@xxxxxxx
- use -fPIC
* Fri Feb 23 2001 ro@xxxxxxx
- changed neededforbuild <apache> to <apache apache-devel>
@@ -3034,7 +3057,7 @@
- Fix Requires and need for build
* Fri Jun 23 2000 rolf@xxxxxxx
- added support for mcal and calendar functions [BUG#2925]
-* Mon Jun 19 2000 ro@xxxxxxx
+* Sun Jun 18 2000 ro@xxxxxxx
- fixed to compile with new postgres
* Mon May 22 2000 rolf@xxxxxxx
- update to 4.0.0

++++++ php-5.2.6-arrayobject-mess.patch ++++++
Index: ext/spl/spl_array.c
===================================================================
RCS file: /repository/php-src/ext/spl/spl_array.c,v
retrieving revision 1.71.2.17.2.15
retrieving revision 1.71.2.17.2.18
diff -u -p -r1.71.2.17.2.15 -r1.71.2.17.2.18
--- ext/spl/spl_array.c 31 Dec 2007 07:20:11 -0000 1.71.2.17.2.15
+++ ext/spl/spl_array.c 6 Oct 2008 13:45:42 -0000 1.71.2.17.2.18
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: spl_array.c,v 1.71.2.17.2.15 2007/12/31 07:20:11 sebastian Exp $ */
+/* $Id: spl_array.c,v 1.71.2.17.2.18 2008/10/06 13:45:42 colder Exp $ */

#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -255,6 +255,7 @@ static zval **spl_array_get_dimension_pt
spl_array_object *intern =
(spl_array_object*)zend_object_store_get_object(object TSRMLS_CC);
zval **retval;
long index;
+ HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);

/* We cannot get the pointer pointer so we don't allow it here for now
if (check_inherited && intern->fptr_offset_get) {
@@ -267,9 +268,17 @@ static zval **spl_array_get_dimension_pt

switch(Z_TYPE_P(offset)) {
case IS_STRING:
- if (zend_symtable_find(spl_array_get_hash_table(intern, 0
TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) ==
FAILURE) {
- zend_error(E_NOTICE, "Undefined index: %s",
Z_STRVAL_P(offset));
- return &EG(uninitialized_zval_ptr);
+ if (zend_symtable_find(ht, Z_STRVAL_P(offset),
Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) {
+ if (type == BP_VAR_W || type == BP_VAR_RW) {
+ zval *value;
+ ALLOC_INIT_ZVAL(value);
+ zend_symtable_update(ht, Z_STRVAL_P(offset),
Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL);
+ zend_symtable_find(ht, Z_STRVAL_P(offset),
Z_STRLEN_P(offset)+1, (void **) &retval);
+ return retval;
+ } else {
+ zend_error(E_NOTICE, "Undefined index: %s",
Z_STRVAL_P(offset));
+ return &EG(uninitialized_zval_ptr);
+ }
} else {
return retval;
}
@@ -282,9 +291,17 @@ static zval **spl_array_get_dimension_pt
} else {
index = Z_LVAL_P(offset);
}
- if (zend_hash_index_find(spl_array_get_hash_table(intern, 0
TSRMLS_CC), index, (void **) &retval) == FAILURE) {
- zend_error(E_NOTICE, "Undefined offset: %ld",
Z_LVAL_P(offset));
- return &EG(uninitialized_zval_ptr);
+ if (zend_hash_index_find(ht, index, (void **) &retval) ==
FAILURE) {
+ if (type == BP_VAR_W || type == BP_VAR_RW) {
+ zval *value;
+ ALLOC_INIT_ZVAL(value);
+ zend_hash_index_update(ht, index,
(void**)&value, sizeof(void*), NULL);
+ zend_hash_index_find(ht, index, (void **)
&retval);
+ return retval;
+ } else {
+ zend_error(E_NOTICE, "Undefined offset: %ld",
Z_LVAL_P(offset));
+ return &EG(uninitialized_zval_ptr);
+ }
} else {
return retval;
}
@@ -1180,6 +1197,7 @@ static void spl_array_method(INTERNAL_FU
spl_array_object *intern =
(spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC);
HashTable *aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC);
zval tmp, *arg;
+ zval *retval_ptr = NULL;

INIT_PZVAL(&tmp);
Z_TYPE(tmp) = IS_ARRAY;
@@ -1190,9 +1208,12 @@ static void spl_array_method(INTERNAL_FU
zend_throw_exception(spl_ce_BadMethodCallException,
"Function expects exactly one argument", 0 TSRMLS_CC);
return;
}
- zend_call_method(NULL, NULL, NULL, fname, fname_len,
&return_value, 2, &tmp, arg TSRMLS_CC);
+ zend_call_method(NULL, NULL, NULL, fname, fname_len,
&retval_ptr, 2, &tmp, arg TSRMLS_CC);
} else {
- zend_call_method(NULL, NULL, NULL, fname, fname_len,
&return_value, 1, &tmp, NULL TSRMLS_CC);
+ zend_call_method(NULL, NULL, NULL, fname, fname_len,
&retval_ptr, 1, &tmp, NULL TSRMLS_CC);
+ }
+ if (retval_ptr) {
+ COPY_PZVAL_TO_ZVAL(*return_value, retval_ptr);
}
}

Index: ext/spl/spl_directory.c
===================================================================
RCS file: /repository/php-src/ext/spl/spl_directory.c,v
retrieving revision 1.45.2.27.2.26
retrieving revision 1.45.2.27.2.29
diff -u -p -r1.45.2.27.2.26 -r1.45.2.27.2.29
--- ext/spl/spl_directory.c 13 Feb 2008 12:23:26 -0000 1.45.2.27.2.26
+++ ext/spl/spl_directory.c 11 Sep 2008 15:32:15 -0000 1.45.2.27.2.29
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: spl_directory.c,v 1.45.2.27.2.26 2008/02/13 12:23:26 helly Exp $ */
+/* $Id: spl_directory.c,v 1.45.2.27.2.29 2008/09/11 15:32:15 lbarnaud Exp $ */

#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -426,6 +426,7 @@ static spl_filesystem_object * spl_files
&use_include_path,
&intern->u.file.zcontext) == FAILURE) {
php_set_error_handling(EH_NORMAL, NULL
TSRMLS_CC);
intern->u.file.open_mode = NULL;
+ intern->file_name = NULL;
zval_dtor(return_value);
Z_TYPE_P(return_value) = IS_NULL;
return NULL;
@@ -1055,7 +1056,7 @@ SPL_METHOD(RecursiveDirectoryIterator, g
INIT_PZVAL(&zpath);
ZVAL_STRINGL(&zpath, intern->file_name, intern->file_name_len, 0);

- spl_instantiate_arg_ex1(spl_ce_RecursiveDirectoryIterator,
&return_value, 0, &zpath TSRMLS_CC);
+ spl_instantiate_arg_ex1(Z_OBJCE_P(getThis()), &return_value, 0, &zpath
TSRMLS_CC);

subdir =
(spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC);
if (subdir) {
@@ -2214,7 +2215,9 @@ SPL_METHOD(SplFileObject, seek)
spl_filesystem_file_rewind(getThis(), intern TSRMLS_CC);

while(intern->u.file.current_line_num < line_pos) {
- spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC);
+ if (spl_filesystem_file_read_line(getThis(), intern, 1
TSRMLS_CC) == FAILURE) {
+ break;
+ }
}
} /* }}} */

Index: ext/spl/spl_iterators.c
===================================================================
RCS file: /repository/php-src/ext/spl/spl_iterators.c,v
retrieving revision 1.73.2.30.2.31
retrieving revision 1.73.2.30.2.33
diff -u -p -r1.73.2.30.2.31 -r1.73.2.30.2.33
--- ext/spl/spl_iterators.c 12 Mar 2008 13:24:24 -0000 1.73.2.30.2.31
+++ ext/spl/spl_iterators.c 22 Sep 2008 13:15:16 -0000 1.73.2.30.2.33
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/

-/* $Id: spl_iterators.c,v 1.73.2.30.2.31 2008/03/12 13:24:24 colder Exp $ */
+/* $Id: spl_iterators.c,v 1.73.2.30.2.33 2008/09/22 13:15:16 felipe Exp $ */

#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -1118,6 +1118,9 @@ static inline void spl_dual_it_rewind(sp

static inline int spl_dual_it_valid(spl_dual_it_object *intern TSRMLS_DC)
{
+ if (!intern->inner.iterator) {
+ return FAILURE;
+ }
/* FAILURE / SUCCESS */
return intern->inner.iterator->funcs->valid(intern->inner.iterator
TSRMLS_CC);
}
@@ -1360,6 +1363,10 @@ SPL_METHOD(RegexIterator, accept)
int subject_len, use_copy, count, result_len;
zval subject_copy, zcount, *replacement;

+ if (intern->current.data == NULL) {
+ RETURN_FALSE;
+ }
+
if (intern->u.regex.flags & REGIT_USE_KEY) {
if (intern->current.key_type == HASH_KEY_IS_LONG) {
subject_len = slprintf(tmp, sizeof(tmp), "%ld",
intern->current.int_key);
Index: ext/spl/examples/tests/dualiterator_001.phpt
===================================================================
RCS file: /repository/php-src/ext/spl/examples/tests/dualiterator_001.phpt,v
retrieving revision 1.2.2.3
retrieving revision 1.2.2.4
diff -u -p -r1.2.2.3 -r1.2.2.4
--- ext/spl/examples/tests/dualiterator_001.phpt 10 Dec 2006 23:44:49
-0000 1.2.2.3
+++ ext/spl/examples/tests/dualiterator_001.phpt 14 Aug 2008 23:46:55
-0000 1.2.2.4
@@ -1,7 +1,7 @@
--TEST--
SPL: DualIterator
--SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
+<?php if (!extension_loaded("spl") || !extension_loaded("reflection")) print
"skip"; ?>
--FILE--
<?php

Index: ext/spl/tests/dit_002.phpt
===================================================================
RCS file: /repository/php-src/ext/spl/tests/dit_002.phpt,v
retrieving revision 1.1.4.2
retrieving revision 1.1.4.3
diff -u -p -r1.1.4.2 -r1.1.4.3
--- ext/spl/tests/dit_002.phpt 13 Feb 2008 12:23:26 -0000 1.1.4.2
+++ ext/spl/tests/dit_002.phpt 14 Aug 2008 23:46:55 -0000 1.1.4.3
@@ -1,7 +1,7 @@
--TEST--
SPL: DirectoryIterator defaults
--SKIPIF--
-<?php if (!extension_loaded("spl")) print "skip"; ?>
+<?php if (!extension_loaded("spl") || !extension_loaded('reflection')) print
"skip"; ?>
--FILE--
<?php

++++++ php-5.2.6-bnc-435595.patch ++++++
Index: ext/standard/array.c
===================================================================
--- ext/standard/array.c.orig 2008-03-12 20:13:00.000000000 +0100
+++ ext/standard/array.c 2008-11-12 17:09:37.000000000 +0100
@@ -2637,42 +2637,34 @@ PHP_FUNCTION(array_reverse)
Returns a copy of input array padded with pad_value to size pad_size */
PHP_FUNCTION(array_pad)
{
- zval **input; /* Input array */
- zval **pad_size; /* Size to pad to */
- zval **pad_value; /* Padding value obviously */
+ zval *input; /* Input array */
+ zval *pad_value; /* Padding value obviously */
zval ***pads; /* Array to pass to splice */
- HashTable *new_hash; /* Return value from splice */
- int input_size; /* Size of the input array */
- int pad_size_abs; /* Absolute value of pad_size */
- int num_pads; /* How many pads do we need */
- int do_pad; /* Whether we should do padding at all */
+ HashTable *new_hash;/* Return value from splice */
+ long pad_size; /* Size to pad to */
+ long pad_size_abs; /* Absolute value of pad_size */
+ int input_size; /* Size of the input array */
+ int num_pads; /* How many pads do we need */
+ int do_pad; /* Whether we should do padding at all
*/
int i;
-
- /* Get arguments and do error-checking */
- if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &input,
&pad_size, &pad_value) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- /* Make sure arguments are of the proper type */
- if (Z_TYPE_PP(input) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The argument
should be an array");
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "alz", &input,
&pad_size, &pad_value) == FAILURE) {
return;
}
- convert_to_long_ex(pad_size);
-
+
/* Do some initial calculations */
- input_size = zend_hash_num_elements(Z_ARRVAL_PP(input));
- pad_size_abs = abs(Z_LVAL_PP(pad_size));
+ input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
+ pad_size_abs = abs(pad_size);
if (pad_size_abs < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad
up to 1048576 elements at a time");
zval_dtor(return_value);
RETURN_FALSE;
}
do_pad = (input_size >= pad_size_abs) ? 0 : 1;
-
+
/* Copy the original array */
- RETVAL_ZVAL(*input, 1, 0);
-
+ RETVAL_ZVAL(input, 1, 0);
+
/* If no need to pad, no need to continue */
if (!do_pad) {
return;
@@ -2680,18 +2672,18 @@ PHP_FUNCTION(array_pad)

/* Populate the pads array */
num_pads = pad_size_abs - input_size;
- if(num_pads > 1048576) {
+ if (num_pads > 1048576) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad
up to 1048576 elements at a time");
zval_dtor(return_value);
RETURN_FALSE;
}
pads = (zval ***)safe_emalloc(num_pads, sizeof(zval **), 0);
for (i = 0; i < num_pads; i++) {
- pads[i] = pad_value;
+ pads[i] = &pad_value;
}

/* Pad on the right or on the left */
- if (Z_LVAL_PP(pad_size) > 0) {
+ if (pad_size > 0) {
new_hash = php_splice(Z_ARRVAL_P(return_value), input_size, 0,
pads, num_pads, NULL);
} else {
new_hash = php_splice(Z_ARRVAL_P(return_value), 0, 0, pads,
num_pads, NULL);
@@ -2704,7 +2696,7 @@ PHP_FUNCTION(array_pad)
}
*Z_ARRVAL_P(return_value) = *new_hash;
FREE_HASHTABLE(new_hash);
-
+
/* Clean up */
efree(pads);
}
++++++ php-5.2.6-CVE-2008-2829.patch ++++++
Index: ext/imap/config.m4
===================================================================
RCS file: /repository/php-src/ext/imap/config.m4,v
retrieving revision 1.69.4.7
retrieving revision 1.69.4.8
diff -u -p -r1.69.4.7 -r1.69.4.8
--- ext/imap/config.m4 11 Feb 2007 09:25:32 -0000 1.69.4.7
+++ ext/imap/config.m4 16 Oct 2008 16:20:53 -0000 1.69.4.8
@@ -1,5 +1,5 @@
dnl
-dnl $Id: config.m4,v 1.69.4.7 2007/02/11 09:25:32 tony2001 Exp $
+dnl $Id: config.m4,v 1.69.4.8 2008/10/16 16:20:53 dmitry Exp $
dnl

AC_DEFUN([IMAP_INC_CHK],[if test -r "$i$1/c-client.h"; then
@@ -229,4 +229,34 @@ if test "$PHP_IMAP" != "no"; then
AC_MSG_RESULT(no)
AC_MSG_ERROR([build test failed. Please check the config.log for
details.])
], $TST_LIBS)
+
+ AC_MSG_CHECKING(whether rfc822_output_address_list function present)
+ PHP_TEST_BUILD(foobar, [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_RFC822_OUTPUT_ADDRESS_LIST, 1, [ ])
+ ], [
+ AC_MSG_RESULT(no)
+ ], [
+ $TST_LIBS
+ ], [
+ void mm_log(void){}
+ void mm_dlog(void){}
+ void mm_flags(void){}
+ void mm_fatal(void){}
+ void mm_critical(void){}
+ void mm_nocritical(void){}
+ void mm_notify(void){}
+ void mm_login(void){}
+ void mm_diskerror(void){}
+ void mm_status(void){}
+ void mm_lsub(void){}
+ void mm_list(void){}
+ void mm_exists(void){}
+ void mm_searched(void){}
+ void mm_expunged(void){}
+ void rfc822_output_address_list(void);
+ void (*f)(void);
+ char foobar () {f = rfc822_output_address_list;}
+ ])
+
fi
Index: ext/imap/php_imap.c
===================================================================
RCS file: /repository/php-src/ext/imap/php_imap.c,v
retrieving revision 1.208.2.7.2.31
retrieving revision 1.208.2.7.2.37
diff -u -p -r1.208.2.7.2.31 -r1.208.2.7.2.37
--- ext/imap/php_imap.c 17 Apr 2008 11:04:49 -0000 1.208.2.7.2.31
+++ ext/imap/php_imap.c 16 Oct 2008 16:20:53 -0000 1.208.2.7.2.37
@@ -26,7 +26,7 @@
| PHP 4.0 updates: Zeev Suraski <zeev@xxxxxxxx> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_imap.c,v 1.208.2.7.2.31 2008/04/17 11:04:49 felipe Exp $ */
+/* $Id: php_imap.c,v 1.208.2.7.2.37 2008/10/16 16:20:53 dmitry Exp $ */

#define IMAP41

@@ -40,6 +40,7 @@
#include "ext/standard/php_string.h"
#include "ext/standard/info.h"
#include "ext/standard/file.h"
+#include "ext/standard/php_smart_str.h"

#ifdef ERROR
#undef ERROR
@@ -66,10 +67,11 @@ MAILSTREAM DEFAULTPROTO;
#define SENDBUFLEN 16385
#endif

+
static void _php_make_header_object(zval *myzvalue, ENVELOPE *en TSRMLS_DC);
static void _php_imap_add_body(zval *arg, BODY *body TSRMLS_DC);
-static void _php_imap_parse_address(ADDRESS *addresslist, char **fulladdress,
zval *paddress TSRMLS_DC);
-static int _php_imap_address_size(ADDRESS *addresslist);
+static char* _php_imap_parse_address(ADDRESS *addresslist, zval *paddress
TSRMLS_DC);
+static char* _php_rfc822_write_address(ADDRESS *addresslist TSRMLS_DC);

/* the gets we use */
static char *php_mail_gets(readfn_t f, void *stream, unsigned long size,
GETS_DATA *md);
@@ -717,23 +719,26 @@ PHP_RSHUTDOWN_FUNCTION(imap)
}
/* }}} */

-
-/* {{{ PHP_MINFO_FUNCTION
- */
-PHP_MINFO_FUNCTION(imap)
-{
- php_info_print_table_start();
+#if !defined(CCLIENTVERSION)
#if HAVE_IMAP2004
- php_info_print_table_row(2, "IMAP c-Client Version", "2004");
+#define CCLIENTVERSION "2004"
#elif HAVE_IMAP2001
- php_info_print_table_row(2, "IMAP c-Client Version", "2001");
+#define CCLIENTVERSION "2001"
#elif HAVE_IMAP2000
- php_info_print_table_row(2, "IMAP c-Client Version", "2000");
+#define CCLIENTVERSION "2000"
#elif defined(IMAP41)
- php_info_print_table_row(2, "IMAP c-Client Version", "4.1");
+#define CCLIENTVERSION "4.1"
#else
- php_info_print_table_row(2, "IMAP c-Client Version", "4.0");
+#define CCLIENTVERSION "4.0"
+#endif
#endif
+
+/* {{{ PHP_MINFO_FUNCTION
+ */
+PHP_MINFO_FUNCTION(imap)
+{
+ php_info_print_table_start();
+ php_info_print_table_row(2, "IMAP c-Client Version", CCLIENTVERSION);
#if HAVE_IMAP_SSL
php_info_print_table_row(2, "SSL Support", "enabled");
#endif
@@ -1451,7 +1456,7 @@ PHP_FUNCTION(imap_list_full)
}
/* }}} */

-/* {{{ proto array imap_scan(resource stream_id, string ref, string pattern,
string content)
+/* {{{ proto array imap_listscan(resource stream_id, string ref, string
pattern, string content)
Read list of mailboxes containing a certain string */
PHP_FUNCTION(imap_listscan)
{
@@ -1575,7 +1580,7 @@ PHP_FUNCTION(imap_headerinfo)
pils *imap_le_struct;
MESSAGECACHE *cache;
ENVELOPE *en;
- char dummy[2000], fulladdress[MAILTMPLEN];
+ char dummy[2000], fulladdress[MAILTMPLEN + 1];
int myargc = ZEND_NUM_ARGS();

if (myargc < 2 || myargc > 5 || zend_get_parameters_ex(myargc,
&streamind, &msgno, &fromlength, &subjectlength, &defaulthost) == FAILURE) {
@@ -1587,8 +1592,8 @@ PHP_FUNCTION(imap_headerinfo)
convert_to_long_ex(msgno);
if (myargc >= 3) {
convert_to_long_ex(fromlength);
- if (Z_LVAL_PP(fromlength) < 0 || Z_LVAL_PP(fromlength) >=
MAILTMPLEN) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "From
length has to be between 1 and %i", MAILTMPLEN);
+ if (Z_LVAL_PP(fromlength) < 0 || Z_LVAL_PP(fromlength) >
MAILTMPLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "From
length has to be between 0 and %d", MAILTMPLEN);
RETURN_FALSE;
}
} else {
@@ -1596,8 +1601,8 @@ PHP_FUNCTION(imap_headerinfo)
}
if (myargc >= 4) {
convert_to_long_ex(subjectlength);
- if (Z_LVAL_PP(subjectlength) < 0 || Z_LVAL_PP(subjectlength) >=
MAILTMPLEN) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject
length has to be between 1 and %i", MAILTMPLEN);
+ if (Z_LVAL_PP(subjectlength) < 0 || Z_LVAL_PP(subjectlength) >
MAILTMPLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Subject
length has to be between 0 and %d", MAILTMPLEN);
RETURN_FALSE;
}
} else {
@@ -2109,7 +2114,7 @@ PHP_FUNCTION(imap_rfc822_write_address)
{
zval **mailbox, **host, **personal;
ADDRESS *addr;
- char string[MAILTMPLEN];
+ char *string;

if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &mailbox, &host,
&personal) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
@@ -2137,13 +2142,12 @@ PHP_FUNCTION(imap_rfc822_write_address)
addr->error=NIL;
addr->adl=NIL;

- if (_php_imap_address_size(addr) >= MAILTMPLEN) {
+ string = _php_rfc822_write_address(addr TSRMLS_CC);
+ if (string) {
+ RETVAL_STRING(string, 0);
+ } else {
RETURN_FALSE;
}
-
- string[0]='\0';
- rfc822_write_address(string, addr);
- RETVAL_STRING(string, 1);
}
/* }}} */

@@ -2154,7 +2158,8 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist)
zval **str, **defaulthost, *tovals;
ADDRESS *addresstmp;
ENVELOPE *env;
-
+ char *str_copy;
+
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &str,
&defaulthost) == FAILURE) {
ZEND_WRONG_PARAM_COUNT();
}
@@ -2165,7 +2170,10 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist)

env = mail_newenvelope();

- rfc822_parse_adrlist(&env->to, Z_STRVAL_PP(str),
Z_STRVAL_PP(defaulthost));
+ /* rfc822_parse_adrlist() modifies passed string. Copy it. */
+ str_copy = estrndup(Z_STRVAL_PP(str), Z_STRLEN_PP(str));
+ rfc822_parse_adrlist(&env->to, str_copy, defaulthost);
+ efree(str_copy);

array_init(return_value);

@@ -2873,7 +2881,7 @@ PHP_FUNCTION(imap_fetch_overview)
zval **streamind, **sequence, **pflags;
pils *imap_le_struct;
zval *myoverview;
- char address[MAILTMPLEN];
+ char *address;
long status, flags=0L;
int myargc = ZEND_NUM_ARGS();

@@ -2908,17 +2916,19 @@ PHP_FUNCTION(imap_fetch_overview)
if (env->subject) {
add_property_string(myoverview,
"subject", env->subject, 1);
}
- if (env->from &&
_php_imap_address_size(env->from) < MAILTMPLEN) {
+ if (env->from) {
env->from->next=NULL;
- address[0] = '\0';
- rfc822_write_address(address,
env->from);
- add_property_string(myoverview, "from",
address, 1);
+ address
=_php_rfc822_write_address(env->from TSRMLS_CC);
+ if (address) {
+ add_property_string(myoverview,
"from", address, 0);
+ }
}
- if (env->to && _php_imap_address_size(env->to)
< MAILTMPLEN) {
+ if (env->to) {
env->to->next = NULL;
- address[0] = '\0';
- rfc822_write_address(address, env->to);
- add_property_string(myoverview, "to",
address, 1);
+ address =
_php_rfc822_write_address(env->to TSRMLS_CC);
+ if (address) {
+ add_property_string(myoverview,
"to", address, 0);
+ }
}
if (env->date) {
add_property_string(myoverview, "date",
env->date, 1);
@@ -2961,7 +2971,7 @@ PHP_FUNCTION(imap_mail_compose)
BODY *bod=NULL, *topbod=NULL;
PART *mypart=NULL, *part;
PARAMETER *param, *disp_param = NULL, *custom_headers_param = NULL,
*tmp_param = NULL;
- char *tmp=NULL, *mystring=NULL, *t=NULL, *tempstring=NULL;
+ char *tmp=NULL, *mystring=NULL, *t=NULL, *tempstring=NULL, *str_copy =
NULL;
int toppart = 0;

if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &envelope, &body)
== FAILURE) {
@@ -2978,50 +2988,55 @@ PHP_FUNCTION(imap_mail_compose)
RETURN_FALSE;
}

+#define PHP_RFC822_PARSE_ADRLIST(target, value) \
+ str_copy = estrndup(Z_STRVAL_PP(value), Z_STRLEN_PP(value)); \
+ rfc822_parse_adrlist(target, str_copy, "NO HOST"); \
+ efree(str_copy);
+
env = mail_newenvelope();
if (zend_hash_find(Z_ARRVAL_PP(envelope), "remail", sizeof("remail"),
(void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- env->remail=cpystr(Z_STRVAL_PP(pvalue));
+ env->remail = cpystr(Z_STRVAL_PP(pvalue));
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "return_path",
sizeof("return_path"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue)
- rfc822_parse_adrlist(&env->return_path, Z_STRVAL_PP(pvalue),
"NO HOST");
+ PHP_RFC822_PARSE_ADRLIST(&env->return_path, pvalue);
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "date", sizeof("date"), (void
**) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- env->date=cpystr(Z_STRVAL_PP(pvalue));
+ env->date = cpystr(Z_STRVAL_PP(pvalue));
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "from", sizeof("from"), (void
**) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->from, Z_STRVAL_PP(pvalue), "NO
HOST");
+ PHP_RFC822_PARSE_ADRLIST(&env->from, pvalue);
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "reply_to",
sizeof("reply_to"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->reply_to, Z_STRVAL_PP(pvalue), "NO
HOST");
+ PHP_RFC822_PARSE_ADRLIST(&env->reply_to, pvalue);
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "in_reply_to",
sizeof("in_reply_to"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- env->in_reply_to=cpystr(Z_STRVAL_PP(pvalue));
+ env->in_reply_to = cpystr(Z_STRVAL_PP(pvalue));
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "subject", sizeof("subject"),
(void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- env->subject=cpystr(Z_STRVAL_PP(pvalue));
+ env->subject = cpystr(Z_STRVAL_PP(pvalue));
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "to", sizeof("to"), (void **)
&pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->to, Z_STRVAL_PP(pvalue), "NO HOST");
+ PHP_RFC822_PARSE_ADRLIST(&env->to, pvalue);
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "cc", sizeof("cc"), (void **)
&pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->cc, Z_STRVAL_PP(pvalue), "NO HOST");
+ PHP_RFC822_PARSE_ADRLIST(&env->cc, pvalue);
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "bcc", sizeof("bcc"), (void
**) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- rfc822_parse_adrlist (&env->bcc, Z_STRVAL_PP(pvalue), "NO
HOST");
+ PHP_RFC822_PARSE_ADRLIST(&env->bcc, pvalue);
}
if (zend_hash_find(Z_ARRVAL_PP(envelope), "message_id",
sizeof("message_id"), (void **) &pvalue)== SUCCESS) {
convert_to_string_ex(pvalue);
- env->message_id=cpystr(Z_STRVAL_PP(pvalue));
+ env->message_id = cpystr(Z_STRVAL_PP(pvalue));
}

if (zend_hash_find(Z_ARRVAL_PP(envelope), "custom_headers",
sizeof("custom_headers"), (void **) &pvalue)== SUCCESS) {
@@ -3858,6 +3873,43 @@ static int _php_rfc822_len(char *str)
/* }}} */

/* Support Functions */
+
+#ifdef HAVE_RFC822_OUTPUT_ADDRESS_LIST
+/* {{{ _php_rfc822_soutr
+ */
+static long _php_rfc822_soutr (void *stream, char *string)
+{
+ smart_str *ret = (smart_str*)stream;
+ int len = strlen(string);
+
+ smart_str_appendl(ret, string, len);
+ return LONGT;
+}
+
+/* }}} */
+
+/* {{{ _php_rfc822_write_address
+ */
+static char* _php_rfc822_write_address(ADDRESS *addresslist TSRMLS_DC)
+{
+ char address[MAILTMPLEN];
+ smart_str ret = {0};
+ RFC822BUFFER buf;
+
+ buf.beg = address;
+ buf.cur = buf.beg;
+ buf.end = buf.beg + sizeof(address) - 1;
+ buf.s = &ret;
+ buf.f = _php_rfc822_soutr;
+ rfc822_output_address_list(&buf, addresslist, 0, NULL);
+ rfc822_output_flush(&buf);
+ smart_str_0(&ret);
+ return ret.c;
+}
+/* }}} */
+
+#else
+
/* {{{ _php_imap_get_address_size
*/
static int _php_imap_address_size (ADDRESS *addresslist)
@@ -3887,26 +3939,33 @@ static int _php_imap_address_size (ADDRE

/* }}} */

+/* {{{ _php_rfc822_write_address
+ */
+static char* _php_rfc822_write_address(ADDRESS *addresslist TSRMLS_DC)
+{
+ char address[SENDBUFLEN];

+ if (_php_imap_address_size(addresslist) >= SENDBUFLEN) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Address buffer
overflow");
+ return NULL;
+ }
+ address[0] = 0;
+ rfc822_write_address(address, addresslist);
+ return estrdup(address);
+}
+/* }}} */
+#endif
/* {{{ _php_imap_parse_address
*/
-static void _php_imap_parse_address (ADDRESS *addresslist, char **fulladdress,
zval *paddress TSRMLS_DC)
+static char* _php_imap_parse_address (ADDRESS *addresslist, zval *paddress
TSRMLS_DC)
{
+ char *fulladdress;
ADDRESS *addresstmp;
zval *tmpvals;
- char *tmpstr;
- int len=0;

addresstmp = addresslist;

- if ((len = _php_imap_address_size(addresstmp))) {
- tmpstr = (char *) pemalloc(len + 1, 1);
- tmpstr[0] = '\0';
- rfc822_write_address(tmpstr, addresstmp);
- *fulladdress = tmpstr;
- } else {
- *fulladdress = NULL;
- }
+ fulladdress = _php_rfc822_write_address(addresstmp TSRMLS_CC);

addresstmp = addresslist;
do {
@@ -3918,6 +3977,7 @@ static void _php_imap_parse_address (ADD
if (addresstmp->host) add_property_string(tmpvals, "host",
addresstmp->host, 1);
add_next_index_object(paddress, tmpvals TSRMLS_CC);
} while ((addresstmp = addresstmp->next));
+ return fulladdress;
}
/* }}} */

@@ -3944,10 +4004,9 @@ static void _php_make_header_object(zval
if (en->to) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
- _php_imap_parse_address(en->to, &fulladdress, paddress
TSRMLS_CC);
+ fulladdress = _php_imap_parse_address(en->to, paddress
TSRMLS_CC);
if (fulladdress) {
- add_property_string(myzvalue, "toaddress", fulladdress,
1);
- free(fulladdress);
+ add_property_string(myzvalue, "toaddress", fulladdress,
0);
}
add_assoc_object(myzvalue, "to", paddress TSRMLS_CC);
}
@@ -3955,10 +4014,9 @@ static void _php_make_header_object(zval
if (en->from) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
- _php_imap_parse_address(en->from, &fulladdress, paddress
TSRMLS_CC);
+ fulladdress = _php_imap_parse_address(en->from, paddress
TSRMLS_CC);
if (fulladdress) {
- add_property_string(myzvalue, "fromaddress",
fulladdress, 1);
- free(fulladdress);
+ add_property_string(myzvalue, "fromaddress",
fulladdress, 0);
}
add_assoc_object(myzvalue, "from", paddress TSRMLS_CC);
}
@@ -3966,10 +4024,9 @@ static void _php_make_header_object(zval
if (en->cc) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
- _php_imap_parse_address(en->cc, &fulladdress, paddress
TSRMLS_CC);
+ fulladdress = _php_imap_parse_address(en->cc, paddress
TSRMLS_CC);
if (fulladdress) {
- add_property_string(myzvalue, "ccaddress", fulladdress,
1);
- free(fulladdress);
+ add_property_string(myzvalue, "ccaddress", fulladdress,
0);
}
add_assoc_object(myzvalue, "cc", paddress TSRMLS_CC);
}
@@ -3977,10 +4034,9 @@ static void _php_make_header_object(zval
if (en->bcc) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
- _php_imap_parse_address(en->bcc, &fulladdress, paddress
TSRMLS_CC);
+ fulladdress = _php_imap_parse_address(en->bcc, paddress
TSRMLS_CC);
if (fulladdress) {
- add_property_string(myzvalue, "bccaddress",
fulladdress, 1);
- free(fulladdress);
+ add_property_string(myzvalue, "bccaddress",
fulladdress, 0);
}
add_assoc_object(myzvalue, "bcc", paddress TSRMLS_CC);
}
@@ -3988,10 +4044,9 @@ static void _php_make_header_object(zval
if (en->reply_to) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
- _php_imap_parse_address(en->reply_to, &fulladdress, paddress
TSRMLS_CC);
+ fulladdress = _php_imap_parse_address(en->reply_to, paddress
TSRMLS_CC);
if (fulladdress) {
- add_property_string(myzvalue, "reply_toaddress",
fulladdress, 1);
- free(fulladdress);
+ add_property_string(myzvalue, "reply_toaddress",
fulladdress, 0);
}
add_assoc_object(myzvalue, "reply_to", paddress TSRMLS_CC);
}
@@ -3999,10 +4054,9 @@ static void _php_make_header_object(zval
if (en->sender) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
- _php_imap_parse_address(en->sender, &fulladdress, paddress
TSRMLS_CC);
+ fulladdress = _php_imap_parse_address(en->sender, paddress
TSRMLS_CC);
if (fulladdress) {
- add_property_string(myzvalue, "senderaddress",
fulladdress, 1);
- free(fulladdress);
+ add_property_string(myzvalue, "senderaddress",
fulladdress, 0);
}
add_assoc_object(myzvalue, "sender", paddress TSRMLS_CC);
}
@@ -4010,10 +4064,9 @@ static void _php_make_header_object(zval
if (en->return_path) {
MAKE_STD_ZVAL(paddress);
array_init(paddress);
- _php_imap_parse_address(en->return_path, &fulladdress, paddress
TSRMLS_CC);
+ fulladdress = _php_imap_parse_address(en->return_path, paddress
TSRMLS_CC);
if (fulladdress) {
- add_property_string(myzvalue, "return_pathaddress",
fulladdress, 1);
- free(fulladdress);
+ add_property_string(myzvalue, "return_pathaddress",
fulladdress, 0);
}
add_assoc_object(myzvalue, "return_path", paddress TSRMLS_CC);
}
++++++ php-5.2.6-qa-ppc64-bug24155.patch ++++++
Index: ext/gd/libgd/gd.c
===================================================================
RCS file: /repository/php-src/ext/gd/libgd/gd.c,v
retrieving revision 1.90.2.1.2.23
diff -u -p -r1.90.2.1.2.23 gd.c
--- ext/gd/libgd/gd.c 31 Jul 2008 09:22:17 -0000 1.90.2.1.2.23
+++ ext/gd/libgd/gd.c 12 Nov 2008 15:07:16 -0000
@@ -1940,7 +1940,7 @@ struct seg {int y, xl, xr, dy;};
/* max depth of stack */
#define FILL_MAX 1200000
#define FILL_PUSH(Y, XL, XR, DY) \
- if (sp<stack+FILL_MAX*10 && Y+(DY)>=0 && Y+(DY)<wy2) \
+ if (sp<stack+FILL_MAX && Y+(DY)>=0 && Y+(DY)<wy2) \
{sp->y = Y; sp->xl = XL; sp->xr = XR; sp->dy = DY; sp++;}

#define FILL_POP(Y, XL, XR, DY) \
++++++ php-5.2.6-systzdata.patch ++++++

Add support for use of the system timezone database, rather
than embedding a copy. Discussed upstream but was not desired.

History:
r4: added "System/Localtime" tzname which uses /etc/localtime
r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert)
r2: add filesystem trawl to set up name alias index
r1: initial revision

--- php-5.2.6/ext/date/lib/parse_tz.c.systzdata
+++ php-5.2.6/ext/date/lib/parse_tz.c
@@ -20,6 +20,16 @@

#include "timelib.h"

+#ifdef HAVE_SYSTEM_TZDATA
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <limits.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "php_scandir.h"
+#endif
+
#include <stdio.h>

#ifdef HAVE_LOCALE_H
@@ -31,7 +41,10 @@
#else
#include <strings.h>
#endif
+
+#ifndef HAVE_SYSTEM_TZDATA
#include "timezonedb.h"
+#endif

#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__)
|| defined(__LITTLE_ENDIAN__))
# if defined(__LITTLE_ENDIAN__)
@@ -206,6 +219,211 @@ void timelib_dump_tzinfo(timelib_tzinfo
}
}

+#ifdef HAVE_SYSTEM_TZDATA
+
+#ifdef HAVE_SYSTEM_TZDATA_PREFIX
+#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX
+#else
+#define ZONEINFO_PREFIX "/usr/share/zoneinfo"
+#endif
+
+#define SYSTEM_TZFILE "/etc/localtime"
+
+static const timelib_tzdb *timezonedb_system = NULL;
+
+/* Filter out some non-tzdata files and the posix/right databases, if
+ * present. */
+static int index_filter(const struct dirent *ent)
+{
+ return strcmp(ent->d_name, ".") != 0
+ && strcmp(ent->d_name, "..") != 0
+ && strcmp(ent->d_name, "posix") != 0
+ && strcmp(ent->d_name, "posixrules") != 0
+ && strcmp(ent->d_name, "right") != 0
+ && strstr(ent->d_name, ".tab") == NULL;
+}
+
+/* Create the zone identifier index by trawling the filesystem. */
+static void create_zone_index(timelib_tzdb *db)
+{
+ size_t dirstack_size, dirstack_top;
+ size_t index_size, index_next;
+ timelib_tzdb_index_entry *db_index;
+ char **dirstack;
+
+ /* LIFO stack to hold directory entries to scan; each slot is a
+ * directory name relative to the zoneinfo prefix. */
+ dirstack_size = 32;
+ dirstack = malloc(dirstack_size * sizeof *dirstack);
+ dirstack_top = 1;
+ dirstack[0] = strdup("");
+
+ /* Index array. */
+ index_size = 64;
+ db_index = malloc(index_size * sizeof *db_index);
+ index_next = 0;
+
+ do {
+ struct dirent **ents;
+ char name[PATH_MAX], *top;
+ int count;
+
+ /* Pop the top stack entry, and iterate through its contents. */
+ top = dirstack[--dirstack_top];
+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top);
+
+ count = php_scandir(name, &ents, index_filter, php_alphasort);
+
+ while (count > 0) {
+ struct stat st;
+ const char *leaf = ents[count - 1]->d_name;
+
+ snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s",
+ top, leaf);
+
+ if (strlen(name) && stat(name, &st) == 0) {
+ /* Name, relative to the zoneinfo prefix. */
+ const char *root = top;
+
+ if (root[0] == '/') root++;
+
+ snprintf(name, sizeof name, "%s%s%s", root,
+ *root ? "/": "", leaf);
+
+ if (S_ISDIR(st.st_mode)) {
+ if (dirstack_top == dirstack_size) {
+ dirstack_size *= 2;
+ dirstack = realloc(dirstack,
+
dirstack_size * sizeof *dirstack);
+ }
+ dirstack[dirstack_top++] = strdup(name);
+ }
+ else {
+ if (index_next == index_size) {
+ index_size *= 2;
+ db_index = realloc(db_index,
+ index_size *
sizeof *db_index);
+ }
+
+ db_index[index_next].id = strdup(name);
+ db_index[index_next++].pos = 0;
+ }
+ }
+
+ free(ents[--count]);
+ }
+
+ if (count != -1) free(ents);
+ free(top);
+ } while (dirstack_top);
+
+ db->index = db_index;
+ db->index_size = index_next;
+
+ free(dirstack);
+}
+
+/* Return the mmap()ed tzfile if found, else NULL. On success, the
+ * length of the mapped data is placed in *length. */
+static char *map_tzfile(const char *timezone, size_t *length)
+{
+ char fname[PATH_MAX];
+ const char *fn;
+ struct stat st;
+ char *p;
+ int fd;
+
+ if (strcmp(timezone, TIMELIB_SYSTEM_TZID) == 0) {
+ fn = SYSTEM_TZFILE;
+ }
+ else {
+ if (strstr(timezone, "..") != NULL) {
+ return NULL;
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+ fn = fname;
+ }
+
+ fd = open(fn, O_RDONLY);
+ if (fd == -1) {
+ return NULL;
+ } else if (fstat(fd, &st) != 0 || st.st_size < 21) {
+ close(fd);
+ return NULL;
+ }
+
+ *length = st.st_size;
+ p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
+ close(fd);
+
+ return p != MAP_FAILED ? p : NULL;
+}
+
+const timelib_tzdb *timelib_builtin_db(void)
+{
+ if (timezonedb_system == NULL) {
+ timelib_tzdb *tmp = malloc(sizeof *tmp);
+
+ tmp->version = "0.system";
+ tmp->data = NULL;
+ create_zone_index(tmp);
+ timezonedb_system = tmp;
+ }
+
+ return timezonedb_system;
+}
+
+const timelib_tzdb_index_entry *timelib_timezone_builtin_identifiers_list(int
*count)
+{
+ *count = timezonedb_system->index_size;
+ return timezonedb_system->index;
+}
+
+int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
+{
+ char fname[PATH_MAX];
+ const char *fn;
+
+ if (strcmp(timezone, TIMELIB_SYSTEM_TZID) == 0) {
+ fn = SYSTEM_TZFILE;
+ }
+ else {
+ if (strstr(timezone, "..") != NULL) {
+ return 0;
+ }
+
+ snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", timezone);
+ fn = fname;
+ }
+
+ return access(fn, R_OK) == 0 ? 1 : 0;
+}
+
+timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
+{
+ char *tzf, *orig;
+ timelib_tzinfo *tmp;
+ size_t len;
+
+ orig = map_tzfile(timezone, &len);
+ if (orig == NULL) {
+ return NULL;
+ }
+
+ tmp = timelib_tzinfo_ctor(timezone);
+
+ tzf = orig + 20;
+ read_header(&tzf, tmp);
+ read_transistions(&tzf, tmp);
+ read_types(&tzf, tmp);
+
+ munmap(orig, len);
+
+ return tmp;
+}
+#else /* !HAVE_SYSTEM_TZDATA */
+
static int seek_to_tz_position(const unsigned char **tzf, char *timezone,
const timelib_tzdb *tzdb)
{
int left = 0, right = tzdb->index_size - 1;
@@ -279,6 +497,7 @@ timelib_tzinfo *timelib_parse_tzfile(cha

return tmp;
}
+#endif

static ttinfo* fetch_timezone_offset(timelib_tzinfo *tz, timelib_sll ts,
timelib_sll *transition_time)
{
--- php-5.2.6/ext/date/lib/timelib.h.systzdata
+++ php-5.2.6/ext/date/lib/timelib.h
@@ -31,6 +31,10 @@

#define TIMELIB_SPECIAL_WEEKDAY 0x01

+#ifdef HAVE_SYSTEM_TZDATA
+#define TIMELIB_SYSTEM_TZID "System/Localtime"
+#endif
+
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
#endif
--- php-5.2.6/ext/date/lib/timelib.m4.systzdata
+++ php-5.2.6/ext/date/lib/timelib.m4
@@ -78,3 +78,17 @@ stdlib.h

dnl Check for strtoll, atoll
AC_CHECK_FUNCS(strtoll atoll strftime)
+
+PHP_ARG_WITH(system-tzdata, for use of system timezone data,
+[ --with-system-tzdata[=DIR] to specify use of system timezone data],
+no, no)
+
+if test "$PHP_SYSTEM_TZDATA" != "no"; then
+ AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
+
+ if test "$PHP_SYSTEM_TZDATA" != "yes"; then
+ AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
+ [Define for location of system timezone data])
+ fi
+fi
+
--- php-5.2.6/ext/date/php_date.c.systzdata
+++ php-5.2.6/ext/date/php_date.c
@@ -584,6 +584,11 @@ static char* guess_timezone(const timeli
if (DATEG(default_timezone) && (strlen(DATEG(default_timezone)) > 0) &&
timelib_timezone_id_is_valid(DATEG(default_timezone), tzdb)) {
return DATEG(default_timezone);
}
+#ifdef TIMELIB_SYSTEM_TZID
+ if (timelib_timezone_id_is_valid(TIMELIB_SYSTEM_TZID, tzdb)) {
+ return TIMELIB_SYSTEM_TZID;
+ }
+#endif
#if HAVE_TM_ZONE
/* Try to guess timezone from system information */
{

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++



Remember to have fun...

--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages