Menu

#503 Divide by zero in TkCanvasArc.c

obsolete: 8.0.3
closed-fixed
nobody
2
2001-04-24
2000-10-31
No

OriginalBugID: 1479 Bug
Version: 8.0.3
SubmitDate: '1999-03-11'
LastModified: '1999-04-16'
Severity: CRIT
Status: Released
Submitter: welch
ChangedBy: rjohnson
OS: HP-UX
OSVersion: 10.20
Machine: Other
FixedDate: '1999-04-16'

Name:
Bob Fletcher

Extensions:
expect

ObservedBehavior:
(note $$%% wincenter could not deal with the mixed case name,
this was tkCanvArc.c)

This bug involves very small arcs. Tk keeps track of a bounding box
to help speed up find close items, and overlapping items. For arcs
it is possible for the exents of this box to cover only one row or
column
of pixels (especially if you scale coordinates) If you are then checking
all items (for a highlight or snap_to_geometry type function) the test
for ths cursor passes thru code that causes an integer divide by zero.

Patch:
768,777c768,769
<
< t1 = (arcPtr->bbox[3] - arcPtr->bbox[1]);
< if (t1 !=0.0) {
< t1 = (pointPtr[1] - vertex[1])/t1;
< }
<
< t2 = (arcPtr->bbox[2] - arcPtr->bbox[0]);
< if (t2 != 0.0) {
< t2 = (pointPtr[0] - vertex[0])/t2;
< }
---
> t1 = (pointPtr[1] - vertex[1])/(arcPtr->bbox[3] - arcPtr->bbox[1]);
> t2 = (pointPtr[0] - vertex[0])/(arcPtr->bbox[2] - arcPtr->bbox[0]);

PatchFiles:
TkCanvasArc.c

I applied this patch. 04/16/1999 17:25 - rjohnson -

Discussion

  • Brent B. Welch

    Brent B. Welch - 2000-10-31
    • priority: 5 --> 2
    • status: open --> closed-fixed
     
  • Don Porter

    Don Porter - 2001-04-24
    • labels: 104343 --> 05. Canvas Items