Re: 1 byte overflow in wordwrap
| From: | Wez Furlong | Date: | Mon, 18 Mar 2002 00:34:12 +0000 |
| Subject: | Re: 1 byte overflow in wordwrap | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-81404@lists.php.net to get a copy of this message | ||
On 18/03/02, "Jim Winstead" <jimw@apache.org> wrote:
> the easiest way to track it down would be to insert some debugging
> statements in the wordwrap() function to print out the text being
> wrapped, the newtextlen that gets calculated, and then value of
> newtextlen at the end of the function.
Well, I wrapped the wordwrap calls in my script to syslog some info:
debug is a function that sticks microtime() output on the front of
a syslog.
function dbg_wordwrap($str, $wrap, $char, $cut=0)
{
debug("wordwrap: str is $str");
debug("wordwrap: bin is " . bin2hex($str));
debug("wordwrap: char=" . ord($char) . " cut=" . $cut);
return wordwrap($str, $wrap, $char, $cut);
}
(Hopefully wordwrapping in this message won't matter too much):
I got 3 of these in a row:
Mar 18 00:28:10 zaneeb httpd: 0.88278100 1016411290 wordwrap: str is
Mar 18 00:28:10 zaneeb httpd: 0.92683800 1016411290 wordwrap: bin is
Mar 18 00:28:10 zaneeb httpd: 0.97130300 1016411290 wordwrap: char=10 cut=0
And I think this is the culprit:
Mar 18 00:28:11 zaneeb httpd: 0.01609200 1016411291 wordwrap: str is Well..with latest CVS I
don't get any leak log entries. --Jani On Sun, 17 Mar 2002, Wez Furlong
wrote: >Jani, > >I've made the streams code use the memory manager in a more
>clever way; could you try with latest CVS and report the >leak output again. >
>Thanks! > >--Wez. > >On 17/03/02, "Jani Taskinen" <sniper@iki.fi>
wrote: >> I get these leaks with even this script: >> >> <?php
phpinfo(); ?> > > > > > -- -- PHP Dev
Mar 18 00:28:11 zaneeb httpd: 0.06023000 1016411291 wordwrap: bin is
0a2020202057656c6c2e2e77697468206c617465737420435653204920646f6e27742067657420616e79206c65616b206c6f6720656e74726965732e0a20202020202020200a202020202d2d4a616e690a202020200a0a0a4f6e2053756e2c203137204d617220323030322c2057657a204675726c6f6e672077726f74653a0a0a3e4a616e692c0a3e0a3e49277665206d616465207468652073747265616d7320636f64652075736520746865206d656d6f7279206d616e6167657220696e2061206d6f72650a3e636c65766572207761793b20636f756c6420796f752074727920776974682
Mar 18 00:28:11 zaneeb httpd: 0.09354100 1016411291 wordwrap: char=10 cut=0
[Mon Mar 18 00:28:37 2002] Script: '/home/CLIENTWEB/worlddo/www/managedo/my/index.php'
---------------------------------------
/home/wez/src/php/PHPDEV/Zend/zend_execute_API.c(274) : Block 0x0882D4B0 status:
/home/wez/src/php/PHPDEV/Zend/zend_variables.c(44) : Actual location (location was relayed)
Beginning: OK (allocated on /home/wez/src/php/PHPDEV/ext/standard/string.c:670, 142 bytes)
End: Overflown (magic=0x2A8FCC00 instead of 0x2A8FCC84)
1 byte(s) overflown
---------------------------------------