tags 539307 + unreproducible
thanks

Hi Vladimir,

On Tuesday, 16. March 2010, Vladimir Stavrinov wrote:
> On Tue, Mar 16, 2010 at 10:54:45AM +0100, Jan Wagner wrote:
> > Anyways ... indicating from your backtrace, your crashing function seems
> > imagepsfreefont() and not imagepstext(), as you mentioned ealier.
> 
> I have found the source of problem. It is chain of errors. It is right
> that imagepstext() fail. Why? Because it take boolean "FALSE" instead of
> image resource as first parameter. This value is returned by
> imagecreate() where height and width is calculated from imagepsbbox(),
> but this last function return wrong value for left x-coordinate if
> mt_rand() is used to generate random angle. Don't understand why. Here
> is short example:
> 
> <?php
> $size = 64;
> $code = ($argv[1]) ? $argv[1] : date("r");
> $angle = 0;
> $angle = mt_rand(20,40)*((mt_rand(0,1)) ? 1 : -1);
> print "\$angle = " . $angle . "\n";
> $font = imagepsloadfont("/usr/share/fonts/type1/gsfonts/c059036l.pfb");
> print_r(imagepsbbox( $code, $font, $size, 0, 0, $angle ));
> ?>
> 
> But when purge suhosin this problem go away. Thus there are something
> wrong in mt_rand() in conjunction with suhosin.

r...@test:~# vi /etc/php5/
apache2/ cli/     conf.d/  
r...@test:~# vi /etc/php5/conf.d/suhosin.ini 
r...@test:~# cat /var/www/test.php 
<?php
$size = 64;
$code = ($argv[1]) ? $argv[1] : date("r");
$angle = 0;
$angle = mt_rand(20,40)*((mt_rand(0,1)) ? 1 : -1);
print "\$angle = " . $angle . "\n";
$font = imagepsloadfont("/usr/share/fonts/type1/gsfonts/c059036l.pfb");
print_r(imagepsbbox( $code, $font, $size, 0, 0, $angle ));
?>

r...@test:~# php5 /var/www/test.php
PHP Notice:  Undefined offset: 1 in /var/www/test.php on line 3
$angle = -24
Array
(
    [0] => -137438953
    [1] => -416
    [2] => 954
    [3] => 43
)

r...@test:~# dpkg -l |grep php5-suhosin
ii  php5-suhosin                    0.9.29-1+b1                advanced 
protection module for php5
r...@test:~# dpkg -l |grep php5-common 
ii  php5-common                     5.3.2-1                    Common files 
for packages built from the php

Now purging php5-suhosin:

r...@test:~# php5 /var/www/test.php
PHP Notice:  Undefined offset: 1 in /var/www/test.php on line 3
$angle = -25
Array
(
    [0] => -1
    [1] => -434
    [2] => 951
    [3] => 43
)

r...@test:~# dpkg -l |grep php5-suhosin
r...@test:~# 

I can't reproduce your problem, sorry.

With kind regards, Jan.
-- 
Never write mail to <w...@spamfalle.info>, you have been warned!
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GIT d-- s+: a C+++ UL++++ P+ L+++ E--- W+++ N+++ o++ K++ w--- O M V- PS PE Y++
PGP++ t-- 5 X R tv- b+ DI D+ G++ e++ h---- r+++ y++++ 
------END GEEK CODE BLOCK------

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to