mirror of
https://github.com/opencv/opencv.git
synced 2026-12-02 21:22:43 -06:00
ca53fa88bd6e8ac56db0d386f14436e7d910377d
ASan, ColorCorrectionModel::read + correctImage on a model whose polyfit linearization has deg: 3 and a 1x1 coefficient Mat: ERROR: AddressSanitizer: heap-buffer-overflow READ of size 8 in cv::ccm::Polyfit::fromEW(double) linearize.cpp:64 0x609000000a48 is located 0 bytes after 8-byte region Polyfit::read takes deg and the coefficient Mat p from the file without checking them against each other, and fromEW then reads p.at<double>(d, 0) for every d <= deg. This affects all four polyfit linearizations (LogPolyfit stores a Polyfit). A CV_32F coefficient Mat of the right length overruns the buffer the same way. The fix checks deg >= 0, a CV_64FC1 coefficient Mat and deg + 1 coefficients in Polyfit::read. This matches what the fitting constructor produces (cv::solve on an n x (deg+1) CV_64F system), so models saved by ColorCorrectionModel::write load as before. The regression test fails on the unpatched tree and passes with the fix. All Photo_ColorCorrection tests pass under ASan with opencv_extra data.
OpenCV: Open Source Computer Vision Library
Resources
- Homepage: https://opencv.org
- Courses: https://opencv.org/courses
- Docs: https://docs.opencv.org/5.x/
- Q&A forum: https://forum.opencv.org
- previous forum (read only): http://answers.opencv.org
- Issue tracking: https://github.com/opencv/opencv/issues
- Additional OpenCV functionality: https://github.com/opencv/opencv_contrib
- Donate to OpenCV: https://opencv.org/support/
Contributing
Please read the contribution guidelines before starting work on a pull request.
Summary of the guidelines:
- One pull request per issue;
- Choose the right base branch;
- Include tests and documentation;
- Clean up "oops" commits before submitting;
- Follow the coding style guide.
Additional Resources
- Submit your OpenCV-based project for inclusion in Community Friday on opencv.org
- Subscribe to the OpenCV YouTube Channel featuring OpenCV Live, an hour-long streaming show
- Follow OpenCV on LinkedIn for daily posts showing the state-of-the-art in computer vision & AI
- Apply to be an OpenCV Volunteer to help organize events and online campaigns as well as amplify them
- Follow OpenCV on Mastodon in the Fediverse
- Follow OpenCV on X
- OpenCV.ai: Computer Vision and AI development services from the OpenCV team.
Description
Languages
C++
87.7%
C
3.1%
Python
2.9%
CMake
2%
Java
1.5%
Other
2.6%