Bug #81578 [Fbk]: Conditional jump or move depends on uninitialised value(s)
Edit report at https://bugs.php.net/bug.php?id=81578&edit=1
ID: 81578
Updated by: nikic@php.net
Reported by: glash dot gnome at gmail dot com
Summary: Conditional jump or move depends on uninitialised
value(s)
Status: Feedback
Type: Bug
Package: Class/Object related
Operating System: Linux
PHP Version: 8.0Git-2021-10-31 (snap)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Taking a stab in the dark, you're probably trying to treat an internal function as an op_array.
internal functions don't have a doc comment. You need to check the function type for
ZEND_USER_FUNCTION.
Previous Comments:
------------------------------------------------------------------------
[2021-11-02 15:04:36] cmb@php.net
> but the initialization is partly already done in init_op_array ()
> It's missing a :
> op_array-> doc_comment = NULL;
But that is initialized in init_op_array()[1]. Is it possible
that f->op_array is not initialized?
[1] <https://github.com/php/php-src/blob/php-8.0.12/Zend/zend_opcode.c#L65>
------------------------------------------------------------------------
[2021-10-31 15:55:27] glash dot gnome at gmail dot com
Description:
------------
My custom zend_object look for doc_comment and get an error message from valgrind.
I can fix it with ecalloc insteadof emalloc,
// In Zend/zend_arena.h
static zend_always_inline zend_arena* zend_arena_create(size_t size)
{
//zend_arena *arena = (zend_arena*)emalloc(size);
zend_arena *arena = (zend_arena*)ecalloc(size, 1);
[...]
}
but the initialization is partly already done in init_op_array ()
It's missing a :
op_array-> doc_comment = NULL;
but I don't know where.
Can someone take care of it?
Test script:
---------------
static zend_object*
php_gobject_object_create_object(zend_class_entry *class_type)
{
php_gobject_object *intern = zend_object_alloc(sizeof(php_gobject_object), class_type);
zend_object_std_init(&intern->std, class_type);
object_properties_init(&intern->std, class_type);
// [...]
zend_function *f;
ZEND_HASH_FOREACH_PTR(&class_type->function_table, f) {
if (f->op_array.doc_comment) {
php_printf("\n", f->op_array.doc_comment->val);
}
}ZEND_HASH_FOREACH_END();
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81578&edit=1
Thread (4 messages)