After a lot of stepping through tesseract code, I found the problem. 

1)      In file coutln.cpp, function C_OUTLINE::IsLegallyNested(), we 
assign outer_area() to an inT32, parent_area. Then lower in the function, 
we multiple child->outer_area() by parent_area. This caused an integer 
overflow which resulted in a bad sign for the multiplication. The fix was 
to make parent_area an inT64 so that integer overflow cannot happen.


The two 32-bit integers being multiplied were -51874 and 60218. The true 
result should be -3123748532 but the maximum result cannot be greater than 
2^31 or you will have sign/overflow problems, which is the case here. The 
computer result was 1171218764, causing the if-statement to go down the 
wrong path.

dfs







-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/10045fef-c2fd-4c1b-87d8-d7cd5d786272%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to