Bug #51691 [Csd]: Unnecessary realloc causes crash with "interned" strings
| From: | sixd@php.net | Date: | Fri, 30 Apr 2010 00:00:26 +0000 |
| Subject: | Bug #51691 [Csd]: Unnecessary realloc causes crash with "interned" strings | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-150048@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=51691&edit=1
ID: 51691
Updated by: sixd@php.net
Reported by: sixd@php.net
Summary: Unnecessary realloc causes crash with "interned"
strings
Status: Closed
Type: Bug
Package: OCI8 related
Operating System: all
PHP Version: 6SVN-2010-04-29 (SVN)
Assigned To: sixd
New Comment:
Dmitry says that empty strings can be interned.
Previous Comments:
------------------------------------------------------------------------
[2010-04-29 07:13:59] sixd@php.net
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Fixed in trunk. The change was also merged to the PHP 5.3 branch and
will be in
any future PHP 5.3.3 (aka OCI8 1.4.2) release.
------------------------------------------------------------------------
[2010-04-29 07:07:19] sixd@php.net
Automatic comment from SVN on behalf of sixd
Revision: http://svn.php.net/viewvc/?view=revision&revision=298755
Log: Bug #51691 (Unnecessary realloc causes crashes in PHP trunk tests
with interned strings). Updated tests check some other edge cases
------------------------------------------------------------------------
[2010-04-29 06:55:27] sixd@php.net
Description:
------------
These OCI8 tests are crashing after the implementation of "interned
string" in the PHP trunk code:
bind_char_1.phpt
bind_char_2.phpt
bind_char_3.phpt
bind_char_4.phpt
bind_rowid.phpt
error_bind.phpt
This is due to a realloc in php_oci_bind_post_exec() to add a null
terminator for bound data. The crash happens on IN binds that are
interned since realloc is not permitted for interned strings. Because
string IN binds are always null terminated the realloc is unnecessary.
Null strings are apparently not interned so modification of their zval
to force an empty string is OK.
String OUT binds have new memory allocated in php_oci_bind_callback()
and are not interned so they can be realloced. Also all current test
cases already get null terminated output from Oracle.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=51691&edit=1