Re: cvs: php-src(PHP_5_3) / NEWS /ext/fileinfo fileinfo.c
| From: | Marcus Boerger | Date: | Mon, 15 Sep 2008 22:25:08 +0000 |
| Subject: | Re: cvs: php-src(PHP_5_3) / NEWS /ext/fileinfo fileinfo.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-53224@lists.php.net to get a copy of this message | ||
Hello Scott,
Tuesday, September 16, 2008, 12:13:25 AM, you wrote:
> scottmac Mon Sep 15 22:13:25 2008 UTC
> Modified files: (Branch: PHP_5_3)
> /php-src NEWS
> /php-src/ext/fileinfo fileinfo.c
> Log:
> Fixed bug #46086 (Segfault when accessing fileinfo class property)
>
>
> http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.317&r2=1.2027.2.547.2.965.2.318&diff_format=u
> Index: php-src/NEWS
> diff -u php-src/NEWS:1.2027.2.547.2.965.2.317
> php-src/NEWS:1.2027.2.547.2.965.2.318
> --- php-src/NEWS:1.2027.2.547.2.965.2.317 Sun Sep 14 06:47:08 2008
> +++ php-src/NEWS Mon Sep 15 22:13:25 2008
> @@ -2,9 +2,12 @@
>
> |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> ?? ??? 200?, PHP 5.3.0 Alpha 3
> - Upgraded bundled PCRE to version 7.8. (Nuno)
> +- Upgraded bundled sqlite to version 3.6.2. (Scott)
> - Changed error level E_ERROR into E_WARNING in Soap extension methods
> parameter validation. (Felipe)
>
> +- Fixed bug #46086 (Segfault when accessing fileinfo class properties).
> + (Scott)
> - Fixed bug #46072 (Compile failure under IRIX 6.5.30 building util.c) (Greg)
> - Fixed bug #46060 (Phar::addEmptyDir() breaks) (Greg)
> - Fixed bug #46042 (memory leaks with reflection of mb_convert_encoding()).
>
> http://cvs.php.net/viewvc.cgi/php-src/ext/fileinfo/fileinfo.c?r1=1.20.2.13&r2=1.20.2.14&diff_format=u
> Index: php-src/ext/fileinfo/fileinfo.c
> diff -u php-src/ext/fileinfo/fileinfo.c:1.20.2.13
> php-src/ext/fileinfo/fileinfo.c:1.20.2.14
> --- php-src/ext/fileinfo/fileinfo.c:1.20.2.13 Sat Sep 13 21:32:21 2008
> +++ php-src/ext/fileinfo/fileinfo.c Mon Sep 15 22:13:25 2008
> @@ -16,7 +16,7 @@
> +----------------------------------------------------------------------+
> */
>
> -/* $Id: fileinfo.c,v 1.20.2.13 2008/09/13 21:32:21 tony2001 Exp $ */
> +/* $Id: fileinfo.c,v 1.20.2.14 2008/09/15 22:13:25 scottmac Exp $ */
>
> #ifdef HAVE_CONFIG_H
> #include "config.h"
> @@ -100,15 +100,11 @@
> zend_object_value retval;
> struct finfo_object *intern;
>
> - intern = ecalloc(1, sizeof(struct finfo_object));
> - intern->zo.ce = class_type;
> - intern->zo.properties = NULL;
> -#if ZEND_MODULE_API_NO >= 20050922
> - intern->zo.guards = NULL;
> -#else
> - intern->zo.in_get = 0;
> - intern->zo.in_set = 0;
> -#endif
> + intern = emalloc(sizeof(struct finfo_object));
The ecallow actually seemed to be correct as it made sure that both the
inherited stad zend object struct gets initialized as well as anything
beyon that. Now calling zend_object_std_init() obviously prevents a
maintenance nightmare and in this case fixes an error. Still the rest of
the struct needs to be initialized as well.
> +
> + zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
> + zend_hash_copy(intern->zo.properties,
> &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp,
> sizeof(zval *));
> +
> intern->ptr = NULL;
>
> retval.handle = zend_objects_store_put(intern,
> finfo_objects_dtor, NULL, NULL TSRMLS_CC);
Best regards,
Marcus