1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Fixed some issues found by static analysis (4th round)

This commit is contained in:
Maksim Shabunin
2017-06-29 16:40:22 +03:00
parent 64b483c65b
commit e0393f8557
29 changed files with 168 additions and 46 deletions
+5 -3
View File
@@ -1848,7 +1848,7 @@ icvLoadCascadeCART( const char** input_cascade, int n, CvSize orig_window_size )
sscanf( stage, "%d%n", &count, &dl );
stage += dl;
assert( count > 0 );
CV_Assert( count > 0 && count < CV_HAAR_STAGE_MAX);
cascade->stage_classifier[i].count = count;
cascade->stage_classifier[i].classifier =
(CvHaarClassifier*)cvAlloc( count*sizeof(cascade->stage_classifier[i].classifier[0]));
@@ -1862,6 +1862,7 @@ icvLoadCascadeCART( const char** input_cascade, int n, CvSize orig_window_size )
sscanf( stage, "%d%n", &classifier->count, &dl );
stage += dl;
CV_Assert( classifier->count > 0 && classifier->count< CV_HAAR_STAGE_MAX);
classifier->haar_feature = (CvHaarFeature*) cvAlloc(
classifier->count * ( sizeof( *classifier->haar_feature ) +
sizeof( *classifier->threshold ) +
@@ -1878,7 +1879,7 @@ icvLoadCascadeCART( const char** input_cascade, int n, CvSize orig_window_size )
sscanf( stage, "%d%n", &rects, &dl );
stage += dl;
assert( rects >= 2 && rects <= CV_HAAR_FEATURE_MAX );
CV_DbgAssert( rects >= 2 && rects <= CV_HAAR_FEATURE_MAX );
for( k = 0; k < rects; k++ )
{
@@ -1890,7 +1891,7 @@ icvLoadCascadeCART( const char** input_cascade, int n, CvSize orig_window_size )
stage += dl;
classifier->haar_feature[l].rect[k].r = r;
}
sscanf( stage, "%s%n", str, &dl );
sscanf( stage, "%99s%n", str, &dl );
stage += dl;
classifier->haar_feature[l].tilted = strncmp( str, "tilted", 6 ) == 0;
@@ -1926,6 +1927,7 @@ icvLoadCascadeCART( const char** input_cascade, int n, CvSize orig_window_size )
}
stage += dl;
CV_Assert(parent >= 0 && parent < i);
cascade->stage_classifier[i].parent = parent;
cascade->stage_classifier[i].next = next;
cascade->stage_classifier[i].child = -1;