From:             okumurya at hotmail dot com
Operating system: Windows 2000 Professional
PHP version:      4.4.2
PHP Bug Type:     COM related
Bug description:  too much allocate

Description:
------------
In UTF-8, 'Z_STRLEN_P(pval_arg) * sizeof(OLECHAR)' is longer than
Widechar.
So SysAllocStringByteLen copies junk datas.

following is a patch.

--- conversion.c.orig   2006-06-23 11:28:06.496027200 +0900
+++ conversion.c        2006-06-23 14:01:42.838476800 +0900
@@ -247,8 +247,9 @@
 
                        case VT_BSTR:
                                convert_to_string_ex(&pval_arg);
+                  
                                unicode_str = 
php_char_to_OLECHAR(Z_STRVAL_P(pval_arg),
Z_STRLEN_P(pval_arg), codepage TSRMLS_CC);
-                               V_BSTR(var_arg) = SysAllocStringByteLen((char 
*) unicode_str,
Z_STRLEN_P(pval_arg) * sizeof(OLECHAR));
+                               V_BSTR(var_arg) = SysAllocString(unicode_str);
                                efree(unicode_str);
                                break;


-- 
Edit bug report at http://bugs.php.net/?id=37899&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=37899&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=37899&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=37899&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=37899&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=37899&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=37899&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=37899&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=37899&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=37899&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=37899&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=37899&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=37899&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=37899&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=37899&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=37899&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=37899&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=37899&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=37899&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=37899&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=37899&r=mysqlcfg

Reply via email to