From 542f6ca440ea6c6d21a6c2e376a4545e1b2d4903 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Wed, 5 May 2021 11:55:07 +1200 Subject: [PATCH] Fix uses of uninitialised zval SWIG_SetPointerZval() now checks if the passed zval is an object, so use ZVAL_UNDEF() before in cases where we create a zval to pass. --- Lib/php/const.i | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/php/const.i b/Lib/php/const.i index 79c6d2449..3b40c2c7f 100644 --- a/Lib/php/const.i +++ b/Lib/php/const.i @@ -47,6 +47,7 @@ SWIGTYPE [] %{ { zval z; + ZVAL_UNDEF(&z); SWIG_SetPointerZval(&z, (void*)$value, $1_descriptor, 0); zval_copy_ctor(&z); zend_declare_class_constant(SWIGTYPE_$class_ce, "$const_name", sizeof("$const_name") - 1, &z); @@ -90,6 +91,7 @@ SWIGTYPE &&, SWIGTYPE [] { zend_constant c; + ZVAL_UNDEF(&c.value); SWIG_SetPointerZval(&c.value, (void*)$value, $1_descriptor, 0); zval_copy_ctor(&c.value); c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0);