diff options
author | Olly Betts <olly@survex.com> | 2021-05-05 11:55:07 +1200 |
---|---|---|
committer | Olly Betts <olly@survex.com> | 2021-05-05 11:55:07 +1200 |
commit | 542f6ca440ea6c6d21a6c2e376a4545e1b2d4903 (patch) | |
tree | ebc4275941090077ba95f337b09118313f5fa77a /Lib/php/const.i | |
parent | 228b04974dcc395b7da8ad9b5141fce6f1213c20 (diff) | |
download | swig-542f6ca440ea6c6d21a6c2e376a4545e1b2d4903.tar.gz |
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.
Diffstat (limited to 'Lib/php/const.i')
-rw-r--r-- | Lib/php/const.i | 2 |
1 files changed, 2 insertions, 0 deletions
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); |