php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56379 tidy is not binary safe
Submitted: 2005-04-22 02:18 UTC Modified: 2005-10-25 15:33 UTC
From: brion at pobox dot com Assigned: iliaa (profile)
Status: Closed Package: tidy (PECL)
PHP Version: 4.3.10 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
38 + 40 = ?
Subscribe to this entry?

 
 [2005-04-22 02:18 UTC] brion at pobox dot com
Description:
------------
Results of tidy_get_output() sometimes have garbage 
characters appended to the end, and will cut off at any 
embedded null bytes in the output.

The extra bytes seem to come up mainly when using the 
show_body_only and wrap options in combination, though 
there may be other triggers too.

Null bytes may become embedded in text containing � 
or &#0 (without ;!) in the source if a charset option is 
given.

Tested on Ubuntu Linux (Hoary/x86). PHP 4.3.10 and tidy/
libtidy snapshot 20040811-2 from the Ubuntu-provided 
packages.

Tidy extension 1.1 downloaded from PECL site and 
installed via PEAR.


Reproduce code:
---------------
I've put a sample program and suggested patch at:

http://leuksman.com/pages/bugs/tidy


Expected result:
----------------
The first test should always return a clean four lines, 
256 bytes like this:
string(256) "******* ******* ******* ******* ******* 
******* ******* *******
******* ******* ******* ******* ******* ******* ******* 
*******
******* ******* ******* ******* ******* ******* ******* 
*******
******* ******* ******* ******* ******* ******* ******* 
*******
"

Second test should show:
string(56) "<p>This is a null:  Following text should 
stay...</p>
"


Actual result:
--------------
string(261) "******* ******* ******* ******* ******* 
******* ******* *******
******* ******* ******* ******* ******* ******* ******* 
*******
******* ******* ******* ******* ******* ******* ******* 
*******
******* ******* ******* ******* ******* ******* ******* 
*******
 ***
"

string(19) "<p>This is a null: "

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-23 06:14 UTC] mike@php.net
TidyBuffer.size is not utilized.  I'll write a patch, as I'm using tidy with PHP4 too and wondered about the occasional garbage, but I blamed some mysterious memory corruptions...
 [2005-10-25 15:33 UTC] mike@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 16:01:31 2024 UTC