Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_unicode.c php-src NEWS

From: Date: Fri, 24 Mar 2006 16:55:49 +0000
Subject: Re: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_unicode.c php-src NEWS
References: 1  Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-4766@lists.php.net to get a copy of this message
Dmitry, How is this a correct fix? You are efreeing conversion result and then ZVAL_STRINGL() tries to build a string from it? This code crashes now, for example: try {
    echo $u;
} catch(UnicodeConversionException $e) {
    echo $e->getMessage(), "\n";
} -Andrei On Mar 24, 2006, at 2:11 AM, Dmitry Stogov wrote:
     num_conv = zend_convert_from_unicode(conv, &s, &s_len, u, u_len, &status);
-    ZVAL_STRINGL(string, s, s_len, 0);
-
     if (U_FAILURE(status)) {
         int32_t offset = u_countChar32(u, num_conv)-1;
+ + if (s) { + efree(s); + }
         zend_raise_conversion_error_ex("Could not convert Unicode string to binary string", conv, offset, (UG(from_u_error_mode) & ZEND_CONV_ERROR_EXCEPTION) TSRMLS_CC);
         retval = FAILURE;
     }
+    ZVAL_STRINGL(string, s, s_len, 0);
+
     efree((UChar*)u);
     return retval;
} -- Zend Engine CVS Mailing List (http://cvs.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.zend-engine.cvs (#4766) next »