1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #28361 from vrabaud:msan

Prevent a potential crash in FMEstimatorCallback::runKernel #28361
 
With solveCubic sometimes failing, n can be -1.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] There is a reference to the original bug report and related work
- [x] There is accuracy test, performance test and test data in opencv_extra repository, if applicable
      Patch to opencv_extra has the same branch name.
- [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
Vincent Rabaud
2026-01-06 09:07:19 +01:00
committed by GitHub
parent b227993ad5
commit b7efc11b51
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -806,7 +806,7 @@ public:
Mat F(count == 7 ? 9 : 3, 3, CV_64F, f);
int n = count == 7 ? run7Point(m1, m2, F) : run8Point(m1, m2, F);
if( n == 0 )
if( n <= 0 )
_model.release();
else
F.rowRange(0, n*3).copyTo(_model);
+8
View File
@@ -1673,5 +1673,13 @@ TEST(Calib3d_FindFundamentalMat, correctMatches)
cout << np2 << endl;
}
TEST(Calib3d_FindFundamentalMat, Crash)
{
vector<Point2f> m1 = {{245, 128},{284, 226},{140, 60},{133, 127},{71, 218},{152, 138},{181, 106}};
vector<Point2f> m2 = m1;
vector<uchar> mask;
findFundamentalMat(m1, m2, mask, FM_LMEDS, 1, 0.99);
}
}} // namespace
/* End of file. */