Skip to content

Commit 7ebbb73

Browse files
committed
ColPartition: Fix CID 1164543 (Division or modulo by float zero)
Signed-off-by: Stefan Weil <[email protected]>
1 parent eaabe4a commit 7ebbb73

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/textord/colpartition.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -663,10 +663,12 @@ void ColPartition::Absorb(ColPartition* other, WidthCallback* cb) {
663663
// Update the special_blobs_densities_.
664664
memset(special_blobs_densities_, 0, sizeof(special_blobs_densities_));
665665
for (int type = 0; type < BSTT_COUNT; ++type) {
666-
int w1 = boxes_.length(), w2 = other->boxes_.length();
666+
unsigned w1 = boxes_.length();
667+
unsigned w2 = other->boxes_.length();
667668
float new_val = special_blobs_densities_[type] * w1 +
668669
other->special_blobs_densities_[type] * w2;
669670
if (!w1 || !w2) {
671+
ASSERT_HOST((w1 + w2) > 0);
670672
special_blobs_densities_[type] = new_val / (w1 + w2);
671673
}
672674
}

0 commit comments

Comments
 (0)