Skip to content

Commit 7dcfd68

Browse files
committed
Fixed possible division by zero
CID 1375394: cblob()->perimeter() can return zero under some circumstances. Signed-off-by: Noah Metzger <[email protected]>
1 parent 34efcd4 commit 7dcfd68

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ccstruct/blobbox.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,8 @@ class BLOBNBOX:public ELIST_LINK
476476
right_rule_ = 0;
477477
left_crossing_rule_ = 0;
478478
right_crossing_rule_ = 0;
479-
if (area_stroke_width_ == 0.0f && area > 0 && cblob() != NULL)
479+
if (area_stroke_width_ == 0.0f && area > 0 && cblob() != NULL
480+
&& cblob()->perimeter()!=0)
480481
area_stroke_width_ = 2.0f * area / cblob()->perimeter();
481482
owner_ = NULL;
482483
base_char_top_ = box.top();

0 commit comments

Comments
 (0)