com php-src: Fixed bug #69371 (Hash table collision leads to inaccessible array keys): NEWS ext/standard/array.c
ext/standard/tests/array/bug69371.phpt
| From: | Xinchen Hui | Date: | Sun, 05 Apr 2015 10:45:14 +0000 |
| Subject: | com php-src: Fixed bug #69371 (Hash table collision leads to inaccessible array keys): NEWS ext/standard/array.c ext/standard/tests/array/bug69371.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-86084@lists.php.net to get a copy of this message | ||
Commit: b6aeab1b9177f4f6b89e7c1553fd946ea164002c
Author: Xinchen Hui <laruence@php.net> Sun, 5 Apr 2015 18:45:14 +0800
Parents: a5a7db8a6a89f94ad6c640036f3febc05a0bf7c9
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b6aeab1b9177f4f6b89e7c1553fd946ea164002c
Log:
Fixed bug #69371 (Hash table collision leads to inaccessible array keys)
Bugs:
https://bugs.php.net/69371
Changed paths:
M NEWS
M ext/standard/array.c
A ext/standard/tests/array/bug69371.phpt
Diff:
diff --git a/NEWS b/NEWS
index 1e6b646..8709d91 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,8 @@
. Update the MIME type list from the one shipped by Apache HTTPD. (Adam)
- Core:
+ . Fixed bug #69371 (Hash table collision leads to inaccessible array keys).
+ (Laruence)
. Fixed bug #68933 (Invalid read of size 8 in zend_std_read_property).
(Laruence, arjen at react dot com)
. Fixed bug #68868 (Segfault in clean_non_persistent_constants() in SugarCRM
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 1ab9906..536771c 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -4538,6 +4538,8 @@ PHP_FUNCTION(array_multisort)
hash->nNextFreeElement = array_size;
if (repack) {
zend_hash_to_packed(hash);
+ } else {
+ zend_hash_rehash(hash);
}
}
HANDLE_UNBLOCK_INTERRUPTIONS();
diff --git a/ext/standard/tests/array/bug69371.phpt b/ext/standard/tests/array/bug69371.phpt
new file mode 100644
index 0000000..b748e72
--- /dev/null
+++ b/ext/standard/tests/array/bug69371.phpt
@@ -0,0 +1,22 @@
+--TEST--
+Bug #69371 (Hash table collision leads to inaccessible array keys)
+--FILE--
+<?php
+$array = array(
+ "d6_node_type" => 1,
+ "d6_filter_format" => 2,
+ "d6_user" => 3,
+ "d6_field_instance_widget_settings" => 4,
+ "d6_field_formatter_settings" => 5,
+);
+
+$weights = array(
+ 5, 1, 3, 2, 0
+);
+array_multisort($weights, SORT_DESC, SORT_NUMERIC, $array);
+
+var_dump($array["d6_node_type"]);
+
+?>
+--EXPECT--
+int(1)