[PHP-CVS] cvs: php-src /main/streams unicode_filter.c
tony2001Tue May 20 07:48:04 2008 UTC Modified files: /php-src/main/streams unicode_filter.c Log: fix invalid free in Unicode filter http://cvs.php.net/viewvc.cgi/php-src/main/streams/unicode_filter.c?r1=1.7r2=1.8diff_format=u Index: php-src/main/streams/unicode_filter.c diff -u php-src/main/streams/unicode_filter.c:1.7 php-src/main/streams/unicode_filter.c:1.8 --- php-src/main/streams/unicode_filter.c:1.7 Tue Oct 2 17:09:22 2007 +++ php-src/main/streams/unicode_filter.c Tue May 20 07:48:04 2008 @@ -14,7 +14,7 @@ +--+ */ -/* $Id: unicode_filter.c,v 1.7 2007/10/02 17:09:22 tony2001 Exp $ */ +/* $Id: unicode_filter.c,v 1.8 2008/05/20 07:48:04 tony2001 Exp $ */ #include php.h @@ -153,7 +153,7 @@ ucnv_toUnicode(data-conv, destp, (UChar*)((char*)destbuf + destlen), (const char**)src, src + remaining, NULL, FALSE, errCode); if (errCode != U_ZERO_ERROR) { - pefree(destp, data-is_persistent); + pefree(destbuf, data-is_persistent); break; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams unicode_filter.c
tony2001Tue Oct 2 17:09:22 2007 UTC Modified files: /php-src/main/streams unicode_filter.c Log: ucnv_toUnicode() in ICU 3.8 requires target buffer size to be even, otherwise it bails out with U_ILLEGAL_ARGUMENT_ERROR this commit fixes endless loop (due to the absence of error catching) and also fixes the cause of the error http://cvs.php.net/viewvc.cgi/php-src/main/streams/unicode_filter.c?r1=1.6r2=1.7diff_format=u Index: php-src/main/streams/unicode_filter.c diff -u php-src/main/streams/unicode_filter.c:1.6 php-src/main/streams/unicode_filter.c:1.7 --- php-src/main/streams/unicode_filter.c:1.6 Mon Jan 1 09:29:36 2007 +++ php-src/main/streams/unicode_filter.c Tue Oct 2 17:09:22 2007 @@ -14,7 +14,7 @@ +--+ */ -/* $Id: unicode_filter.c,v 1.6 2007/01/01 09:29:36 sebastian Exp $ */ +/* $Id: unicode_filter.c,v 1.7 2007/10/02 17:09:22 tony2001 Exp $ */ #include php.h @@ -144,10 +144,18 @@ UErrorCode errCode = U_ZERO_ERROR; php_stream_bucket *new_bucket; + if ((destlen 1) != 0) { + destlen++; + } + destp = destbuf = (UChar *)pemalloc(destlen, data-is_persistent); ucnv_toUnicode(data-conv, destp, (UChar*)((char*)destbuf + destlen), (const char**)src, src + remaining, NULL, FALSE, errCode); - /* UTODO: Error catching */ + + if (errCode != U_ZERO_ERROR) { + pefree(destp, data-is_persistent); + break; + } new_bucket = php_stream_bucket_new_unicode(stream, destbuf, destp - destbuf, 1, data-is_persistent TSRMLS_CC); php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC); @@ -246,7 +254,6 @@ }; /* }}} */ - /* {{{ unicode.* factory */ static php_stream_filter *php_unicode_filter_create(const char *filtername, zval *filterparams, int persistent TSRMLS_DC) -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams unicode_filter.c
pollita Fri Jul 14 19:15:31 2006 UTC Modified files: /php-src/main/streams unicode_filter.c Log: #38105 (2/3) Filters should report char/UChar count, not bytes http://cvs.php.net/viewvc.cgi/php-src/main/streams/unicode_filter.c?r1=1.1r2=1.2diff_format=u Index: php-src/main/streams/unicode_filter.c diff -u php-src/main/streams/unicode_filter.c:1.1 php-src/main/streams/unicode_filter.c:1.2 --- php-src/main/streams/unicode_filter.c:1.1 Wed Mar 29 01:20:43 2006 +++ php-src/main/streams/unicode_filter.c Fri Jul 14 19:15:31 2006 @@ -14,7 +14,7 @@ +--+ */ -/* $Id: unicode_filter.c,v 1.1 2006/03/29 01:20:43 pollita Exp $ */ +/* $Id: unicode_filter.c,v 1.2 2006/07/14 19:15:31 pollita Exp $ */ #include php.h @@ -79,7 +79,7 @@ php_stream_bucket_append(buckets_out, new_bucket TSRMLS_CC); exit_status = PSFS_PASS_ON; } - consumed += UBYTES(bucket-buflen); + consumed += bucket-buflen; php_stream_bucket_delref(bucket TSRMLS_CC); } @@ -131,7 +131,7 @@ php_stream_bucket_unlink(bucket TSRMLS_CC); if (bucket-buf_type == IS_UNICODE) { /* already in unicode, nothing to do */ - consumed += UBYTES(bucket-buflen); + consumed += bucket-buflen; php_stream_bucket_append(buckets_out, bucket TSRMLS_CC); exit_status = PSFS_PASS_ON; continue; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams unicode_filter.c
pollita Fri Jul 14 22:24:08 2006 UTC Modified files: /php-src/main/streams unicode_filter.c Log: Logic fix: (!a == b) != (a != b) http://cvs.php.net/viewvc.cgi/php-src/main/streams/unicode_filter.c?r1=1.2r2=1.3diff_format=u Index: php-src/main/streams/unicode_filter.c diff -u php-src/main/streams/unicode_filter.c:1.2 php-src/main/streams/unicode_filter.c:1.3 --- php-src/main/streams/unicode_filter.c:1.2 Fri Jul 14 19:15:31 2006 +++ php-src/main/streams/unicode_filter.c Fri Jul 14 22:24:07 2006 @@ -14,7 +14,7 @@ +--+ */ -/* $Id: unicode_filter.c,v 1.2 2006/07/14 19:15:31 pollita Exp $ */ +/* $Id: unicode_filter.c,v 1.3 2006/07/14 22:24:07 pollita Exp $ */ #include php.h @@ -56,7 +56,7 @@ UChar *src = bucket-buf.u; php_stream_bucket_unlink(bucket TSRMLS_CC); - if (!bucket-buf_type == IS_UNICODE) { + if (bucket-buf_type != IS_UNICODE) { /* Already ASCII, can't really do anything with it */ consumed += bucket-buflen; php_stream_bucket_append(buckets_out, bucket TSRMLS_CC); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php