Re: com php-src: Fix bug #73181: NEWS Zend/tests/bug73181.phpt Zend/zend_hash.c
| From: | Dmitry Stogov | Date: | Tue, 27 Sep 2016 20:54:31 +0000 |
| Subject: | Re: com php-src: Fix bug #73181: NEWS Zend/tests/bug73181.phpt Zend/zend_hash.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-94729@lists.php.net to get a copy of this message | ||
May be it's better to disable creating elements with numeric keys in symbol tables? (e.g. throw
exception or skip+warning)
Such elements make no sense anyway.
Thanks. Dmitry.
________________________________
From: Nikita Popov <nikic@php.net>
Sent: Tuesday, September 27, 2016 8:47:48 PM
To: php-cvs@lists.php.net
Subject: [PHP-CVS] com php-src: Fix bug #73181: NEWS Zend/tests/bug73181.phpt Zend/zend_hash.c
Commit: b7cbaa7f43d8a584e273e214209a4f7406a30029
Author: Nikita Popov <nikic@php.net> Tue, 27 Sep 2016 19:47:48 +0200
Parents: cb29c01ed6ff60bb693a0b943bc8993b45c462b4
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b7cbaa7f43d8a584e273e214209a4f7406a30029
Log:
Fix bug #73181
Bugs:
https://bugs.php.net/73181
Changed paths:
M NEWS
A Zend/tests/bug73181.phpt
M Zend/zend_hash.c
Diff:
diff --git a/NEWS b/NEWS
index e45d2b5..0848c2e 100644
--- a/NEWS
+++ b/NEWS
@@ -2,7 +2,9 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2016 PHP 7.0.13
-
+- Core:
+ . Fixed bug #73181 (parse_str() without a second argument leads to crash).
+ (Nikita)
13 Oct 2016 PHP 7.0.12
diff --git a/Zend/tests/bug73181.phpt b/Zend/tests/bug73181.phpt
new file mode 100644
index 0000000..2994e99
--- /dev/null
+++ b/Zend/tests/bug73181.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #73181: parse_str() without a second argument leads to crash
+--FILE--
+<?php
+
+function x() {
+ parse_str("1&x");
+ var_dump(get_defined_vars());
+}
+
+x();
+
+?>
+--EXPECT--
+array(2) {
+ [1]=>
+ string(0) ""
+ ["x"]=>
+ string(0) ""
+}
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index efbc1e2..aecdac6 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -1447,13 +1447,17 @@ ZEND_API void ZEND_FASTCALL zend_symtable_clean(HashTable *ht)
} else if (ht->nNumUsed == ht->nNumOfElements) {
do {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
- zend_string_release(p->key);
+ if (EXPECTED(p->key)) {
+ zend_string_release(p->key);
+ }
} while (++p != end);
} else {
do {
if (EXPECTED(Z_TYPE(p->val) != IS_UNDEF)) {
i_zval_ptr_dtor(&p->val ZEND_FILE_LINE_CC);
- zend_string_release(p->key);
+ if (EXPECTED(p->key)) {
+ zend_string_release(p->key);
+ }
}
} while (++p != end);
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php