summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--Zend/tests/bug71221.phpt10
-rw-r--r--Zend/zend_builtin_functions.c4
3 files changed, 16 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index ce1bf50d16..776f289aa2 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,8 @@ PHP NEWS
?? ??? 2016 PHP 7.0.3
- Core:
+ . Fixed bug #71221 (Null pointer deref (segfault) in get_defined_vars via
+ ob_start). (hugh at allthethings dot co dot nz)
. Fixed bug #71201 (round() segfault on 64-bit builds). (Anatol)
. Added support for new HTTP 451 code. (Julien)
diff --git a/Zend/tests/bug71221.phpt b/Zend/tests/bug71221.phpt
new file mode 100644
index 0000000000..e735302d9e
--- /dev/null
+++ b/Zend/tests/bug71221.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #71221 (Null pointer deref (segfault) in get_defined_vars via ob_start)
+--FILE--
+<?php
+ob_start("get_defined_vars");
+ob_end_clean();
+?>
+okey
+--EXPECT--
+okey
diff --git a/Zend/zend_builtin_functions.c b/Zend/zend_builtin_functions.c
index 6faa57cd99..785632ddbd 100644
--- a/Zend/zend_builtin_functions.c
+++ b/Zend/zend_builtin_functions.c
@@ -1947,6 +1947,10 @@ ZEND_FUNCTION(get_defined_vars)
{
zend_array *symbol_table = zend_rebuild_symbol_table();
+ if (UNEXPECTED(symbol_table == NULL)) {
+ return;
+ }
+
RETURN_ARR(zend_array_dup(symbol_table));
}
/* }}} */