php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27427 imageftbbox() is unstable with text containing newlines
Submitted: 2004-02-27 13:27 UTC Modified: 2004-02-29 05:45 UTC
From: spam747 at mynamehere dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.3.4 OS: Fedora Core 1
Private report: No CVE-ID: None
 [2004-02-27 13:27 UTC] spam747 at mynamehere dot com
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)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-29 05:45 UTC] nlopess@php.net
Could not reproduce with latest PHP 5 snapshot.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jun 07 15:02:39 2024 UTC