php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41589 Image arc with an angle of 361 sends image functions fubar
Submitted: 2007-06-04 18:43 UTC Modified: 2007-06-05 07:46 UTC
From: martin at marsjupiter dot com Assigned: pajoye (profile)
Status: Not a bug Package: GD related
PHP Version: 4.4.7 OS: CentOs
Private report: No CVE-ID: None
 [2007-06-04 18:43 UTC] martin at marsjupiter dot com
Description:
------------
in baaChart v1.4 available from

http://www.phpclasses.org/browse/package/1193.html

a call:

imagearc($this->image,$x,$y,$w,$h,0,361,$this->black);

can be made, as of 4.4.7 this call sends all further line drawing of any kind haywire, with lines generally drawing in white, but the effects really are quite random.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-06-04 18:53 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2007-06-04 20:33 UTC] pajoye@php.net
An angle of 361 means an angle of 1. It will draw from 0 to 1. It results to a couple of pixels from the right of the horizontal axis and down to 1?.

If you think there is another bug, please provide:

- a link to the image you get
- a small script with only gd image functions, no class, db or whatever else not related to the gd functions

and reopen this bug. But given this function call, there is no bug > bogus.
 [2007-06-04 20:42 UTC] martin at marsjupiter dot com
You do not seem to have read the bug report. Such a call is not simply not drawing something, it is causing totally fatal screw ups in the entire image system.
Plainly what you say as regards 361 meaning 1 is a change of behavior, as the same code has been working fine for years, But that is not my concern, if someone putting a silly number in causes a silly result it is not much of an issue. But what happens goes way way beyond trivial.
I will try and create a simple test script at some point, but this bug cost me several hours today already.
 [2007-06-05 04:33 UTC] martin at marsjupiter dot com
Okay issue resolved, imagearg has changed behavior between releases and 361 now does 1 degree and not 361 degrees. This lead to extreme issues in baagraph as that code then goes on to try and imagefill something that no longer exists.

Apologies for any time wasted.
 [2007-06-05 07:46 UTC] pajoye@php.net
"Okay issue resolved, imagearg has changed behavior between releases and 361 now does 1 degree and not 361 degrees."

It was actually a bug (and using large angles ended to DoS).

It is now the normal behavior as there is no logical rule to be applied for angle > 360:

360   full arc (it uses imageellipse/circle)
< 360 draws an arc from start to end.
> 360 use the rest of the angle (angle % 360)

I'm sorry if you have wasted times to debug this class but it is actually the author problem, drawing an arc of 361 degrees makes no sense :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 00:01:32 2024 UTC