svn: /pear/packages/MDB2/trunk/ MDB2/Driver/Datatype/Common.php MDB2/Driver/oci8.php tests/MDB2_internals_testcase.php tests/MDB2_usage_testcase.php
| From: | Daniel O'Connor | Date: | Mon, 21 Nov 2011 11:55:48 +0000 |
| Subject: | svn: /pear/packages/MDB2/trunk/ MDB2/Driver/Datatype/Common.php MDB2/Driver/oci8.php tests/MDB2_internals_testcase.php tests/MDB2_usage_testcase.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-62772@lists.php.net to get a copy of this message | ||
clockwerx Mon, 21 Nov 2011 11:55:48 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=319612
Log:
Bug #18826 Crash and security problem with is_a() in combination with value escaping
Bug: http://pear.php.net/bugs/18826 (unknown)
Changed paths:
U pear/packages/MDB2/trunk/MDB2/Driver/Datatype/Common.php
U pear/packages/MDB2/trunk/MDB2/Driver/oci8.php
U pear/packages/MDB2/trunk/tests/MDB2_internals_testcase.php
U pear/packages/MDB2/trunk/tests/MDB2_usage_testcase.php
Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/Common.php
===================================================================
--- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/Common.php 2011-11-21 10:57:51 UTC (rev 319611)
+++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/Common.php 2011-11-21 11:55:48 UTC (rev 319612)
@@ -1386,7 +1386,7 @@
if (PEAR::isError($db)) {
return $db;
}
- if (isset($db->function) && is_a($db->function,
'MDB2_Driver_Function_Common')) {
+ if (isset($db->function) && is_object($this->function) &&
is_a($db->function, 'MDB2_Driver_Function_Common')) {
return $db->function->now('date');
}
return 'CURRENT_DATE';
@@ -1415,7 +1415,7 @@
if (PEAR::isError($db)) {
return $db;
}
- if (isset($db->function) && is_a($db->function,
'MDB2_Driver_Function_Common')) {
+ if (isset($db->function) && is_object($this->function) &&
is_a($db->function, 'MDB2_Driver_Function_Common')) {
return $db->function->now('timestamp');
}
return 'CURRENT_TIMESTAMP';
@@ -1444,7 +1444,7 @@
if (PEAR::isError($db)) {
return $db;
}
- if (isset($db->function) && is_a($db->function,
'MDB2_Driver_Function_Common')) {
+ if (isset($db->function) && is_object($this->function) &&
is_a($db->function, 'MDB2_Driver_Function_Common')) {
return $db->function->now('time');
}
return 'CURRENT_TIME';
Modified: pear/packages/MDB2/trunk/MDB2/Driver/oci8.php
===================================================================
--- pear/packages/MDB2/trunk/MDB2/Driver/oci8.php 2011-11-21 10:57:51 UTC (rev 319611)
+++ pear/packages/MDB2/trunk/MDB2/Driver/oci8.php 2011-11-21 11:55:48 UTC (rev 319612)
@@ -1208,7 +1208,7 @@
}
if (empty($this->types)) {
foreach (array_keys($buffer) as $key) {
- if (is_a($buffer[$key], 'oci-lob')) {
+ if (is_object($buffer[$key]) && is_a($buffer[$key],
'oci-lob')) {
$buffer[$key] = $buffer[$key]->load();
}
}
@@ -1470,7 +1470,7 @@
while (!feof($fp)) {
$this->values[$parameter] .= fread($fp, 8192);
}
- } elseif (is_a($this->values[$parameter], 'OCI-Lob')) {
+ } elseif (is_object($this->values[$parameter]) &&
is_a($this->values[$parameter], 'OCI-Lob')) {
//do nothing
} elseif ($this->db->getOption('lob_allow_url_include')
&& preg_match('/^(\w+:\/\/)(.*)$/',
$this->values[$parameter], $match)
@@ -1484,7 +1484,7 @@
$lobs[$i]['descriptor'] =& $this->values[$parameter];
// Test to see if descriptor has already been created for this
// variable (i.e. if it has been bound more than once):
- if (!is_a($this->values[$parameter], 'OCI-Lob')) {
+ if (!(is_object($this->values[$parameter]) &&
is_a($this->values[$parameter], 'OCI-Lob'))) {
$this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_LOB);
if (false === $this->values[$parameter]) {
$result = $this->db->raiseError(null, null, null,
@@ -1501,7 +1501,7 @@
} else if ($type == OCI_B_BFILE) {
// Test to see if descriptor has already been created for this
// variable (i.e. if it has been bound more than once):
- if (!is_a($this->values[$parameter], "OCI-Lob")) {
+ if (!(is_object($this->values[$parameter]) &&
is_a($this->values[$parameter], "OCI-Lob"))) {
$this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_FILE);
if (false === $this->values[$parameter]) {
$result = $this->db->raiseError(null, null, null,
@@ -1646,4 +1646,4 @@
return $result;
}
}
-?>
\ No newline at end of file
+?>
Modified: pear/packages/MDB2/trunk/tests/MDB2_internals_testcase.php
===================================================================
--- pear/packages/MDB2/trunk/tests/MDB2_internals_testcase.php 2011-11-21 10:57:51 UTC (rev 319611)
+++ pear/packages/MDB2/trunk/tests/MDB2_internals_testcase.php 2011-11-21 11:55:48 UTC (rev 319612)
@@ -84,7 +84,7 @@
// Suppress handling of PEAR errors while testing next case
PEAR::pushErrorHandling(null);
$result = MDB2::loadClass('null', false);
- $this->assertTrue(is_a($result, 'pear_error'), 'loadClass');
+ $this->assertTrue(is_object($result) && is_a($result, 'pear_error'),
'loadClass');
PEAR::popErrorHandling();
}
@@ -626,4 +626,4 @@
}
-?>
\ No newline at end of file
+?>
Modified: pear/packages/MDB2/trunk/tests/MDB2_usage_testcase.php
===================================================================
--- pear/packages/MDB2/trunk/tests/MDB2_usage_testcase.php 2011-11-21 10:57:51 UTC (rev 319611)
+++ pear/packages/MDB2/trunk/tests/MDB2_usage_testcase.php 2011-11-21 11:55:48 UTC (rev 319612)
@@ -1423,7 +1423,7 @@
while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC)) {
foreach (array('document' => 'clob',
'picture' => 'blob') as $field => $type) {
$lob = $row[$field];
- if (is_a($lob, 'oci-lob')) {
+ if (is_object($lob) && is_a($lob, 'oci-lob')) {
$lob = $lob->load();
} elseif (is_resource($lob)) {
$lob = fread($lob, 1000);
@@ -1947,4 +1947,4 @@
}
}
-?>
\ No newline at end of file
+?>