Skip Menu |

This queue is for tickets about the Math-Geometry-Planar CPAN distribution.

Report information
The Basics
Id: 123498
Status: new
Priority: 0/
Queue: Math-Geometry-Planar

People
Owner: Nobody in particular
Requestors: TPLA [...] cpan.org
Cc:
AdminCc:

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



Subject: _add_segment() trips into endless loop
I have a problem with an endless loop condition in _add_segment(), line 2863 (Planar.pm, 1.18) in the containing while loop: if (($tr[$t]{d0} <= 0) && ($tr[$t]{d1} <= 0)) { # case cannot arise print "add_segment: error\n"; } I need to deal with user-supplied coordinates, the offending sample looks like this (in perl notation) [ [ 33, 656 ], [ 34, 1396 ], [ 747, 1394 ], [ 731, 1113 ], [ 390, 1096 ], [ 387, 617 ], [ 22, 628 ], [ 31, 682 ], [ 0, 677 ], [ 27, 680 ] ] My hunch is that one of the last two coordinates triggers the problem. As this is used in a production system, I hotfixed Planar.pm like thus: if (($tr[$t]{d0} <= 0) && ($tr[$t]{d1} <= 0)) { # case cannot arise print "add_segment: error\n"; last; # exit while() } My question is: is there a way to prevalidate the above data in order to produce a more informative error message (other than "bad data")? Or is this a bug in Planar.pm? Best regards Thomas