Blame SOURCES/php-5.6.5-bug69152.patch

f90754
From fb83c76deec58f1fab17c350f04c9f042e5977d1 Mon Sep 17 00:00:00 2001
f90754
From: Stanislav Malyshev <stas@php.net>
f90754
Date: Sun, 22 Mar 2015 18:17:47 -0700
f90754
Subject: [PATCH] Check that the type is correct
f90754
f90754
---
f90754
 ext/standard/incomplete_class.c | 2 +-
f90754
 1 file changed, 1 insertion(+), 1 deletion(-)
f90754
f90754
diff --git a/ext/standard/incomplete_class.c b/ext/standard/incomplete_class.c
f90754
index 1816ac4..30c82e6 100644
f90754
--- a/ext/standard/incomplete_class.c
f90754
+++ b/ext/standard/incomplete_class.c
f90754
@@ -144,7 +144,7 @@ PHPAPI char *php_lookup_class_name(zval *object, zend_uint *nlen)
f90754
 
f90754
 	object_properties = Z_OBJPROP_P(object);
f90754
 
f90754
-	if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS) {
f90754
+	if (zend_hash_find(object_properties, MAGIC_MEMBER, sizeof(MAGIC_MEMBER), (void **) &val) == SUCCESS && Z_TYPE_PP(val) == IS_STRING) {
f90754
 		retval = estrndup(Z_STRVAL_PP(val), Z_STRLEN_PP(val));
f90754
 
f90754
 		if (nlen) {
f90754
-- 
f90754
2.1.4
f90754
f90754
From a894a8155fab068d68a04bf181dbaddfa01ccbb0 Mon Sep 17 00:00:00 2001
f90754
From: Stanislav Malyshev <stas@php.net>
f90754
Date: Sun, 5 Apr 2015 17:30:59 -0700
f90754
Subject: [PATCH] More fixes for bug #69152
f90754
f90754
---
f90754
 Zend/zend_exceptions.c                     |  3 +++
f90754
 ext/standard/tests/serialize/bug69152.phpt | 16 ++++++++++++++++
f90754
 2 files changed, 19 insertions(+)
f90754
 create mode 100644 ext/standard/tests/serialize/bug69152.phpt
f90754
f90754
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
f90754
index bf90ae7..1ca2ead 100644
f90754
--- a/Zend/zend_exceptions.c
f90754
+++ b/Zend/zend_exceptions.c
f90754
@@ -591,6 +591,9 @@ ZEND_METHOD(exception, getTraceAsString)
f90754
 	str = &res;
f90754
 
f90754
 	trace = zend_read_property(default_exception_ce, getThis(), "trace", sizeof("trace")-1, 1 TSRMLS_CC);
f90754
+	if(Z_TYPE_P(trace) != IS_ARRAY) {
f90754
+		RETURN_FALSE;
f90754
+	}
f90754
 	zend_hash_apply_with_arguments(Z_ARRVAL_P(trace) TSRMLS_CC, (apply_func_args_t)_build_trace_string, 3, str, len, &num);
f90754
 
f90754
 	s_tmp = emalloc(1 + MAX_LENGTH_OF_LONG + 7 + 1);
f90754
diff --git a/ext/standard/tests/serialize/bug69152.phpt b/ext/standard/tests/serialize/bug69152.phpt
f90754
new file mode 100644
f90754
index 0000000..4e74168
f90754
--- /dev/null
f90754
+++ b/ext/standard/tests/serialize/bug69152.phpt
f90754
@@ -0,0 +1,16 @@
f90754
+--TEST--
f90754
+Bug #69152: Type Confusion Infoleak Vulnerability in unserialize()
f90754
+--FILE--
f90754
+
f90754
+$x = unserialize('O:9:"exception":1:{s:16:"'."\0".'Exception'."\0".'trace";s:4:"ryat";}');
f90754
+echo $x;
f90754
+$x =  unserialize('O:4:"test":1:{s:27:"__PHP_Incomplete_Class_Name";R:1;}');
f90754
+$x->test();
f90754
+
f90754
+?>
f90754
+--EXPECTF--
f90754
+exception 'Exception' in %s:%d
f90754
+Stack trace:
f90754
+#0 {main}
f90754
+
f90754
+Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "unknown" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line %d
f90754
-- 
f90754
2.1.4
f90754