mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Add check for array length
This commit is contained in:
parent
3a18b8f4b6
commit
0fd2047fad
@ -23,6 +23,11 @@ array_t *imlib_count_blobs(struct image *image)
|
||||
/* flood fill */
|
||||
point_t *p=point_alloc(x, y);
|
||||
while(p != NULL) {
|
||||
if (array_length(points) > 500) {
|
||||
xfree(p);
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* add point to blob */
|
||||
if (p->x < blob->x) {
|
||||
blob->x = p->x;
|
||||
@ -71,6 +76,7 @@ array_t *imlib_count_blobs(struct image *image)
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
for (int i=0; i<array_length(blobs); i++) {
|
||||
rectangle_t *blob = array_at(blobs, i);
|
||||
// if (blob->w < 10) { /* blob too small */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user