fix for Bug #3085:

weights array is only allocated for (l_count+1) elements,
but then weights[l_count+1] element is accessed.
This commit is contained in:
Vladislav Vinogradov 2013-06-13 10:22:56 +04:00
parent 98f6a4a615
commit e433145b7e

View File

@ -251,7 +251,7 @@ void CvANN_MLP::create( const CvMat* _layer_sizes, int _activ_func,
buf_sz += (l_dst[0] + l_dst[l_count-1]*2)*2;
CV_CALL( wbuf = cvCreateMat( 1, buf_sz, CV_64F ));
CV_CALL( weights = (double**)cvAlloc( (l_count+1)*sizeof(weights[0]) ));
CV_CALL( weights = (double**)cvAlloc( (l_count+2)*sizeof(weights[0]) ));
weights[0] = wbuf->data.db;
weights[1] = weights[0] + l_dst[0]*2;