|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-02-29 05:45 UTC] nlopess@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 13:00:02 2025 UTC |
Description: ------------ Calling imageftbbox() multiple times with the same arguments gives substantially differing results if the text contains a newline. The exact results vary between executions, so an uninitialized variable or buffer overflow is suspected. The results are similar whether the function is run in Apache or from the command line. Changing fonts or the text doesn't have an effect, so long as the text contains a newline (\n). Occurs using the standard Fedora Core 1 php-4.3.4-1.1 from RPM, and also php4-STABLE-200402271630 (configure --with-gd). P.S. the provided email address is valid as-is. Reproduce code: --------------- #!/usr/bin/php -q <?php $size=8; $angle=0; $font="/usr/share/fonts/bitstream-vera/Vera.ttf"; $text="foo\nfoo"; $extra=array(); for ($i=0;$i<10;$i++) { $box=imageftbbox($size,$angle,$font,$text,$extra); echo $box[1]." ".$box[3]."\n"; } ?> Expected result: ---------------- 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 (Perhaps not this exactly, but all the lines should be the same) Actual result: -------------- 1 1 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 15 (On occasion, the second line may match the first, but from the third line on things change)