com php-src: Fixed bug #71220 (Null pointer deref (segfault) in compact via ob_start): NEWS ext/standard/array.c ext/standard
/tests/array/bug71220.phpt
| From: | Xinchen Hui | Date: | Sat, 26 Dec 2015 05:25:53 +0000 |
| Subject: | com php-src: Fixed bug #71220 (Null pointer deref (segfault) in compact via ob_start): NEWS ext/standard/array.c ext/standard /tests/array/bug71220.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-90465@lists.php.net to get a copy of this message | ||
Commit: c56efb848b01fa3ecdb7f7253b541b020d154290
Author: Xinchen Hui <laruence@gmail.com> Fri, 25 Dec 2015 21:25:53 -0800
Parents: 6700be67f58611d08bbacc44f327ce98ed0473c9
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c56efb848b01fa3ecdb7f7253b541b020d154290
Log:
Fixed bug #71220 (Null pointer deref (segfault) in compact via ob_start)
Bugs:
https://bugs.php.net/71220
Changed paths:
M NEWS
M ext/standard/array.c
A ext/standard/tests/array/bug71220.phpt
Diff:
diff --git a/NEWS b/NEWS
index 776f289..932dd4a 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,8 @@ PHP NEWS
immediately). (Laruence)
- Standard:
+ . Fixed bug #71220 (Null pointer deref (segfault) in compact via ob_start).
+ (hugh at allthethings dot co dot nz)
. Fixed bug #71190 (substr_replace converts integers in original $search
array to strings). (Laruence)
. Fixed bug #71188 (str_replace converts integers in original $search array
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 79c9ab6..7d27c0b 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1976,6 +1976,10 @@ PHP_FUNCTION(compact)
symbol_table = zend_rebuild_symbol_table();
+ if (UNEXPECTED(symbol_table == NULL)) {
+ return;
+ }
+
/* compact() is probably most used with a single array of var_names
or multiple string names, rather than a combination of both.
So quickly guess a minimum result size based on that */
diff --git a/ext/standard/tests/array/bug71220.phpt b/ext/standard/tests/array/bug71220.phpt
new file mode 100644
index 0000000..2a852a6
--- /dev/null
+++ b/ext/standard/tests/array/bug71220.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #71220 (Null pointer deref (segfault) in compact via ob_start)
+--FILE--
+<?php
+ob_start("extract");
+ob_end_clean();
+?>
+okey
+--EXPECT--
+okey