Merge pull request #27865 from MaximSmolskiy:fix_invalid_memory_access_in_usac

Fix invalid memory access in USAC #27865

### Pull Request Readiness Checklist

Fix #27863 

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
- [ ] 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:
Maxim Smolskiy 2025-10-06 15:29:44 +03:00 committed by GitHub
parent 19c41c2936
commit b644754226
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -385,7 +385,7 @@ public:
Matx<double, 9, 9> AtA_(AtA), U, Vt;
Vec<double, 9> W;
SVD::compute(AtA_, W, U, Vt, SVD::FULL_UV + SVD::MODIFY_A);
models = std::vector<Mat> { Mat_<double>(3, 3, Vt.val + 72 /*=8*9*/) };
models = std::vector<Mat> { Mat_<double>(3, 3, Vt.val + 72 /*=8*9*/).clone() };
#endif
}
@ -503,7 +503,7 @@ public:
Matx<double, 9, 9> AtA_(covariance), U, Vt;
Vec<double, 9> W;
SVD::compute(AtA_, W, U, Vt, SVD::FULL_UV + SVD::MODIFY_A);
models = std::vector<Mat> { Mat_<double>(3, 3, Vt.val + 72 /*=8*9*/) };
models = std::vector<Mat> { Mat_<double>(3, 3, Vt.val + 72 /*=8*9*/).clone() };
#endif
if (enforce_rank)
FundamentalDegeneracy::recoverRank(models[0], is_fundamental);

View File

@ -253,7 +253,7 @@ public:
Matx<double, 9, 9> Vt;
Vec<double, 9> D;
if (! eigen(Matx<double, 9, 9>(AtA), D, Vt)) return 0;
H = Mat_<double>(3, 3, Vt.val + 72/*=8*9*/);
H = Mat_<double>(3, 3, Vt.val + 72/*=8*9*/).clone();
#endif
}
const auto * const h = (double *) H.data;