Skip to content

Commit 2193f81

Browse files
committed
Fixed CID 1164537 (possible division by zero)
If height_count stays zero the maximal error calculation contains a division by zero. Signed-off-by: Noah Metzger <[email protected]>
1 parent a7d1402 commit 2193f81

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/textord/colpartition.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,8 @@ bool ColPartition::HasGoodBaseline() {
13431343
width = last_pt.x() - first_pt.x();
13441344
}
13451345
// Maximum median error allowed to be a good text line.
1346+
if (height_count == 0)
1347+
return false;
13461348
double max_error = kMaxBaselineError * total_height / height_count;
13471349
ICOORD start_pt, end_pt;
13481350
double error = linepoints.Fit(&start_pt, &end_pt);

0 commit comments

Comments
 (0)