Add patches for

- CVE-2014-8142
- CVE-2015-0231

MFH:		2015Q1
This commit is contained in:
Florian Smeets 2015-02-24 22:36:49 +00:00
parent 990bb0fdf6
commit a3487b0b09
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=379853
3 changed files with 113 additions and 1 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= php53
PORTVERSION= 5.3.29
PORTREVISION?= 3
PORTREVISION?= 4
CATEGORIES?= lang devel www
MASTER_SITES= ${MASTER_SITE_PHP}
MASTER_SITE_SUBDIR= distributions

View File

@ -0,0 +1,56 @@
Index: ext/standard/tests/serialize/bug68594.phpt
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ext/standard/tests/serialize/bug68594.phpt 2015-02-13 11:27:34.753347966 -0500
@@ -0,0 +1,23 @@
+--TEST--
+Bug #68545 Use after free vulnerability in unserialize()
+--FILE--
+<?php
+for ($i=4; $i<100; $i++) {
+ $m = new StdClass();
+
+ $u = array(1);
+
+ $m->aaa = array(1,2,&$u,4,5);
+ $m->bbb = 1;
+ $m->ccc = &$u;
+ $m->ddd = str_repeat("A", $i);
+
+ $z = serialize($m);
+ $z = str_replace("bbb", "aaa", $z);
+ $y = unserialize($z);
+ $z = serialize($y);
+}
+?>
+===DONE===
+--EXPECTF--
+===DONE===
Index: ext/standard/var_unserializer.c
===================================================================
--- ext/standard/var_unserializer.c 2015-02-13 11:27:34.793348294 -0500
+++ ext/standard/var_unserializer.c 2015-02-13 11:27:34.753347966 -0500
@@ -298,6 +298,9 @@
} else {
/* object properties should include no integers */
convert_to_string(key);
+ if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+ var_push_dtor(var_hash, old_data);
+ }
zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,
sizeof data, NULL);
}
Index: ext/standard/var_unserializer.re
===================================================================
--- ext/standard/var_unserializer.re 2015-02-13 11:27:34.793348294 -0500
+++ ext/standard/var_unserializer.re 2015-02-13 11:27:34.753347966 -0500
@@ -304,6 +304,9 @@
} else {
/* object properties should include no integers */
convert_to_string(key);
+ if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+ var_push_dtor(var_hash, old_data);
+ }
zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,
sizeof data, NULL);
}

View File

@ -0,0 +1,56 @@
Index: ext/standard/tests/strings/bug68710.phpt
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ ext/standard/tests/strings/bug68710.phpt 2015-02-13 11:36:32.969760122 -0500
@@ -0,0 +1,25 @@
+--TEST--
+Bug #68710 Use after free vulnerability in unserialize() (bypassing the
+CVE-2014-8142 fix)
+--FILE--
+<?php
+for ($i=4; $i<100; $i++) {
+ $m = new StdClass();
+
+ $u = array(1);
+
+ $m->aaa = array(1,2,&$u,4,5);
+ $m->bbb = 1;
+ $m->ccc = &$u;
+ $m->ddd = str_repeat("A", $i);
+
+ $z = serialize($m);
+ $z = str_replace("aaa", "123", $z);
+ $z = str_replace("bbb", "123", $z);
+ $y = unserialize($z);
+ $z = serialize($y);
+}
+?>
+===DONE===
+--EXPECTF--
+===DONE===
Index: ext/standard/var_unserializer.c
===================================================================
--- ext/standard/var_unserializer.c 2015-02-13 11:36:33.009760449 -0500
+++ ext/standard/var_unserializer.c 2015-02-13 11:36:32.969760122 -0500
@@ -298,7 +298,7 @@
} else {
/* object properties should include no integers */
convert_to_string(key);
- if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+ if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
var_push_dtor(var_hash, old_data);
}
zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,
Index: ext/standard/var_unserializer.re
===================================================================
--- ext/standard/var_unserializer.re 2015-02-13 11:36:33.009760449 -0500
+++ ext/standard/var_unserializer.re 2015-02-13 11:36:32.969760122 -0500
@@ -304,7 +304,7 @@
} else {
/* object properties should include no integers */
convert_to_string(key);
- if (zend_symtable_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
+ if (zend_hash_find(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, (void **)&old_data)==SUCCESS) {
var_push_dtor(var_hash, old_data);
}
zend_hash_update(ht, Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &data,