Skip to content

Commit db907e5

Browse files
author
Scott MacVicar
committed
Fixed bug #46086 (Segfault when accessing fileinfo class property)
1 parent 8bb2465 commit db907e5

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? 200?, PHP 5.3.0 Alpha 3
44
- Upgraded bundled PCRE to version 7.8. (Nuno)
5+
- Upgraded bundled sqlite to version 3.6.2. (Scott)
56
- Changed error level E_ERROR into E_WARNING in Soap extension methods
67
parameter validation. (Felipe)
78

9+
- Fixed bug #46086 (Segfault when accessing fileinfo class properties).
10+
(Scott)
811
- Fixed bug #46072 (Compile failure under IRIX 6.5.30 building util.c) (Greg)
912
- Fixed bug #46060 (Phar::addEmptyDir() breaks) (Greg)
1013
- Fixed bug #46042 (memory leaks with reflection of mb_convert_encoding()).

ext/fileinfo/fileinfo.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,11 @@ PHP_FILEINFO_API zend_object_value finfo_objects_new(zend_class_entry *class_typ
100100
zend_object_value retval;
101101
struct finfo_object *intern;
102102

103-
intern = ecalloc(1, sizeof(struct finfo_object));
104-
intern->zo.ce = class_type;
105-
intern->zo.properties = NULL;
106-
#if ZEND_MODULE_API_NO >= 20050922
107-
intern->zo.guards = NULL;
108-
#else
109-
intern->zo.in_get = 0;
110-
intern->zo.in_set = 0;
111-
#endif
103+
intern = emalloc(sizeof(struct finfo_object));
104+
105+
zend_object_std_init(&intern->zo, class_type TSRMLS_CC);
106+
zend_hash_copy(intern->zo.properties, &class_type->default_properties, (copy_ctor_func_t) zval_add_ref,(void *) &tmp, sizeof(zval *));
107+
112108
intern->ptr = NULL;
113109

114110
retval.handle = zend_objects_store_put(intern, finfo_objects_dtor, NULL, NULL TSRMLS_CC);

0 commit comments

Comments
 (0)