Bug #81578 [NEW]: Conditional jump or move depends on uninitialised value(s)

From: Date: Sun, 31 Oct 2021 15:55:27 +0000
Subject: Bug #81578 [NEW]: Conditional jump or move depends on uninitialised value(s)
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237477@lists.php.net to get a copy of this message
From:             glash dot gnome at gmail dot com
Operating system: Linux
PHP version:      8.0Git-2021-10-31 (snap)
Package:          Class/Object related
Bug Type:         Bug
Bug description:Conditional jump or move depends on uninitialised value(s)

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 bug report at https://bugs.php.net/bug.php?id=81578&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=81578&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=81578&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=81578&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=81578&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=81578&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=81578&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=81578&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=81578&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=81578&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=81578&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=81578&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=81578&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=81578&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=81578&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=81578&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=81578&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=81578&r=mysqlcfg


Thread (4 messages)

« previous php.bugs (#237477) next »