Bug #81578 [Opn->Fbk]: Conditional jump or move depends on uninitialised value(s)

From: Date: Tue, 02 Nov 2021 15:04:36 +0000
Subject: Bug #81578 [Opn->Fbk]: Conditional jump or move depends on uninitialised value(s)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237513@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81578&edit=1

 ID:                 81578
 Updated by:         cmb@php.net
 Reported by:        glash dot gnome at gmail dot com
 Summary:            Conditional jump or move depends on uninitialised
                     value(s)
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Linux
 PHP Version:        8.0Git-2021-10-31 (snap)
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

> 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>


Previous Comments:
------------------------------------------------------------------------
[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)

« previous php.bugs (#237513) next »