Bug #376

Crash on to many blobs + fix

Added by Anonymous over 3 years ago.

Status:New Start:07/16/2009
Priority:Normal Due date:
Assigned to:- % Done:

90%

Category:- Spent time: -
Target version:Version 1.3 (Community Core Release) Estimated time:0.10 hour

Description

CCV has been infrequently crashing on me every time there have been a lot of blobs or noise so I looked into it and I think I found the problem:
In the findContours method of the ContourFinder class there is a check in line 98 which reads:

nCvSeqsFound < TOUCH_MAX_CONTOUR_LENGTH

I think this should be:

nCvSeqsFound < TOUCH_MAX_CONTOURS

instead as in the following line:

cvSeqBlobs[nCvSeqsFound]

nCvSeqsFound is used to index the array cvSeqBlobs which has been initialized like this:

CvSeq* cvSeqBlobs[TOUCH_MAX_CONTOURS]

Otherwise if there are too much contours detected the array is indexed out of bounds (TOUCH_MAX_CONTOUR_LENGTH is defined as 1024 where as TOUCH_MAX_CONTOURS is defined as 128).

Also available in: Atom PDF