is this code in modules/flann/src/miniflann.cpp a bug?
Using an experimental new static analysis technique we (GrammaTech) detected what may be a bug in createIndicesDists, miniflann.cpp:
static void createIndicesDists(OutputArray _indices, OutputArray _dists,
Mat& indices, Mat& dists, int rows,
int minCols, int maxCols, int dtype)
{
if( _indices.needed() )
{
indices = _indices.getMat();
if( !indices.isContinuous() || indices.type() != CV_32S ||
indices.rows != rows || indices.cols < minCols || indices.cols > maxCols )
{
if( !indices.isContinuous() )
_indices.release();
_indices.create( rows, minCols, CV_32S );
indices = _indices.getMat();
}
}
else
indices.create( rows, minCols, CV_32S );
if( _dists.needed() )
{
dists = _dists.getMat();
if( !dists.isContinuous() || dists.type() != dtype ||
dists.rows != rows || dists.cols < minCols || dists.cols > maxCols )
{
if( !indices.isContinuous() ) // HERE! should this be 'dists'?
_dists.release();
_dists.create( rows, minCols, dtype );
dists = _dists.getMat();
}
}
else
dists.create( rows, minCols, dtype );
}
The block of code operating on _dists/dists appears to be a copy of the above block operating on _indices/indices, with all of the occurrences of _indices/indices changed to _dists/dists except the one noted in the "HERE!" comment. This inconsistency couid be intentional, but it is highly suspicious. Can anyone "in the know" confirm or deny that this is a bug?
github link of the mentioned code it seems a bug. let us ask developers cc @mshabunin
Yes, looks like a bug. Please create an issue in the tracker or submit a pull request with the fix.
Do I need to create another separate account for your bug tracking system, or does the one used for this site cover both? It is surprising that I don't find a link to your bug tracking site on this page...
i already did https://github.com/opencv/opencv/pull...