From 2193f81702f109c8adc1783e0ec51e2ef2fb64bc Mon Sep 17 00:00:00 2001 From: Noah Metzger Date: Thu, 3 May 2018 14:55:41 +0200 Subject: [PATCH] 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 --- src/textord/colpartition.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/textord/colpartition.cpp b/src/textord/colpartition.cpp index 8366ee8d..f540de67 100644 --- a/src/textord/colpartition.cpp +++ b/src/textord/colpartition.cpp @@ -1343,6 +1343,8 @@ bool ColPartition::HasGoodBaseline() { width = last_pt.x() - first_pt.x(); } // Maximum median error allowed to be a good text line. + if (height_count == 0) + return false; double max_error = kMaxBaselineError * total_height / height_count; ICOORD start_pt, end_pt; double error = linepoints.Fit(&start_pt, &end_pt);