php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57703 Apache segfault running captcha.php example script
Submitted: 2007-06-15 17:05 UTC Modified: 2007-06-24 19:22 UTC
From: oliviapurvis at yahoo dot com Assigned:
Status: Closed Package: imagick (PECL)
PHP Version: 5_2 CVS-2007-06-15 OS: Redhat Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: oliviapurvis at yahoo dot com
New email:
PHP Version: OS:

 

 [2007-06-15 17:05 UTC] oliviapurvis at yahoo dot com
Description:
------------
I'm running PHP 5.2.3, Apache 2.0, ImageMagick 6.3.0 10/18/06 Q16 and imagick 2.0.0a3. When I run the example script 'captcha.php' provided by the source package, apache gives a segfault.

The log says:
child pid 32609 exit signal Segmentation fault (11)

Reproduce code:
---------------
captcha.php in the /example folder of the source package.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-16 16:50 UTC] mkoppanen@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2007-06-19 16:34 UTC] oliviapurvis at yahoo dot com
Hi, generating a backtrace is beyond my current level of expertise. However this error is very easy to reproduce. Just run the captcha.php example script provided in the source package. You need to run it on a Linux machine. It runs fine on my Windows XP machine.
 [2007-06-19 20:14 UTC] mkoppanen@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.

Could you try the CVS version of Imagick and captcha.php and report the results?
 [2007-06-22 13:31 UTC] oliviapurvis at yahoo dot com
I upgraded to the CVS version and ran captcha.php. There is no segfault. But I get this error:

PHP Fatal error:  Uncaught exception 'ImagickException' with message 'unable to read font 'Helvetica Regular'' in /home/site/www/captcha.php:31
Stack trace:
#0 /home/site/www/captcha.php(31): Imagick->annotateimage(Object(ImagickDraw), 4, 20, 0, 'H7RBAT')
#1 {main}
thrown in /home/site/www/captcha.php on line 31

If I comment out the line:
$ImagickDraw->setFont( 'Helvetica Regular' );
and run the script, I get this error:

PHP Fatal error:  Uncaught exception 'ImagickDrawException' with message 'Font needs to be set before annotating an image' in /home/site/www/captcha.php:28
Stack trace:
#0 /home/site/www/captcha.php(28): Imagick->annotateimage(Object(ImagickDraw), 4, 20, 0, 'BT927Z')
#1 {main}
thrown in /home/site/www/captcha.php on line 28

Does that mean that I must set a font before I can annotate? Using the MagickWand extension by ImageMagick, I can annotate without setting a font.
 [2007-06-22 14:00 UTC] oliviapurvis at yahoo dot com
The test in comment above is done using ImageMagick 6.3.0. I now upgraded to ImageMagick 6.3.4. Then I try to compile Imagick CVS version. It won't even compile. I got an error in the 'make' step:

/home/pecl/imagick/imagick.c: In function 'zim_imagickdraw_annotation':
/home/pecl/imagick/imagick.c:13054: 'font' undeclared (first use in this function)
/home/pecl/imagick/imagick.c:13054: (Each undeclared identifier is reported only once
/home/pecl/imagick/imagick.c:13054: for each function it appears in.)
make: *** [imagick.lo] Error 1

Is this a bug?
 [2007-06-23 16:02 UTC] mkoppanen@php.net
Fixed the compile error from CVS.

I tested earlier and I was able to reproduce your segfault with ImageMagick version 6.3.2. If font was not set before annotations segfaulted.

The compile error was from my error (left one function call outside #if block).

$ImagickDraw->setFont( 'Helvetica Regular' ); is just an example font. The fonts are configured in ImageMagick configuration files. You can also specify a full path to .ttf file.

The CVS version should compile now so can you please retry?
 [2007-06-23 17:39 UTC] mkoppanen@php.net
The version mentioned in earlier comment was supposed to be 6.3.0
 [2007-06-24 19:05 UTC] oliviapurvis at yahoo dot com
Tested with latest CVS. Works fine. No more compilation error.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 14:01:29 2024 UTC