Skip Menu |

This queue is for tickets about the GD-Graph3d CPAN distribution.

Report information
The Basics
Id: 33528
Status: new
Priority: 0/
Queue: GD-Graph3d

People
Owner: Nobody in particular
Requestors: Fred.Meyer [...] schwab.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Illegal division by zero in lines3d.pm at line 416
Date: Fri, 22 Feb 2008 19:54:44 -0800
To: <bug-GD-Graph3d [...] rt.cpan.org>
From: "Meyer, Fred" <Fred.Meyer [...] schwab.com>
In generating a lines3d chart, I received the following error: Illegal division by zero at C:/Perl/site/lib/GD/Graph/lines3d.pm line 416 # Module: GD::Graph::lines3d GD-Graph3d-0.63 from ActiveState PPM Code below indicates that it is possible for $x2 and $xe to be equal as shown on line 397: "if( $x2 == $xe ) {", so the division by ($x2 - $xe) below at line 416 is invalid and should be handled: # Now find next point and nudge these coords to mitre if( ref $next->{coords} eq 'ARRAY' ) { my( $lwyo2, $lwxo2 ); my( $x2, $y2 ) = @{$next->{coords}}; Line 397 --> if( $x2 == $xe ) { $lwxo2 = $lw / 2; $lwyo2 = 0; } elsif( $y2 == $ye ) { $lwxo2 = 0; $lwyo2 = $lw / 2; } else { my $ln2 = sqrt( ($ye-$y2)**2 + ($x2-$xe)**2 ); $lwyo2 = ($x2-$xe) / $ln2 * $lw / 2; $lwxo2 = ($ye-$y2) / $ln2 * $lw / 2; } # end if $next->{face} = []; $next->{face}[0] = $x2 - $lwxo2; $next->{face}[1] = $y2 - $lwyo2; $next->{face}[2] = $x2 + $lwxo2; $next->{face}[3] = $y2 + $lwyo2; # Now get the intersecting coordinates my $mt = ($ye - $ys)/($xe - $xs); Line 416 --> my $mn = ($y2 - $ye)/($x2 - $xe); my $bt = $this->{face}[1] - $this->{face}[0] * $mt; my $bn = $next->{face}[1] - $next->{face}[0] * $mn; if( $mt != $mn ) { $this->{face}[0] = ($bn - $bt) / ($mt - $mn); } # end if $this->{face}[1] = $mt * $this->{face}[0] + $bt; $bt = $this->{face}[3] - $this->{face}[2] * $mt; $bn = $next->{face}[3] - $next->{face}[2] * $mn; if( $mt != $mn ) { $this->{face}[2] = ($bn - $bt) / ($mt - $mn); } # end if $this->{face}[3] = $mt * $this->{face}[2] + $bt; } # end if WARNING: All e-mail sent to or from the Charles Schwab corporate e-mail system is subject to archival, monitoring and/or review by Schwab personnel.

Message body is not shown because it is too large.