tony2001 Tue, 08 Dec 2009 12:12:23 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=291874
Log: sync with 5_3 Changed paths: U php/php-src/trunk/ext/iconv/iconv.c Modified: php/php-src/trunk/ext/iconv/iconv.c =================================================================== --- php/php-src/trunk/ext/iconv/iconv.c 2009-12-08 11:00:03 UTC (rev 291873) +++ php/php-src/trunk/ext/iconv/iconv.c 2009-12-08 12:12:23 UTC (rev 291874) @@ -740,36 +740,39 @@ if (err != PHP_ICONV_ERR_SUCCESS) { return err; } - - /* normalize the offset and the length */ - if (offset < 0) { - if ((offset += total_len) < 0) { - offset = 0; - } - } + if (len < 0) { if ((len += (total_len - offset)) < 0) { - len = 0; + return PHP_ICONV_ERR_SUCCESS; } } - if((unsigned int) len > total_len) { + if (offset < 0) { + if ((offset += total_len) < 0) { + return PHP_ICONV_ERR_SUCCESS; + } + } + + if(len > total_len) { len = total_len; } - if ((unsigned int) offset >= total_len) { + + if (offset >= total_len) { return PHP_ICONV_ERR_SUCCESS; } - if ((unsigned int) (offset + len) > total_len) { + if ((offset + len) > total_len ) { /* trying to compute the length */ len = total_len - offset; } if (len == 0) { + smart_str_appendl(pretval, "", 0); + smart_str_0(pretval); return PHP_ICONV_ERR_SUCCESS; } - + cd1 = iconv_open(GENERIC_SUPERSET_NAME, enc); if (cd1 == (iconv_t)(-1)) {
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php