1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +04:00

Merge pull request #29040 from MrBear999-ui:project4_MrBear

imgproc: add kernel size validation in boxFilter #29040

Check that ksize dimensions are strictly positive in boxFilter(), returning StsBadSize error instead of producing undefined behavior. 

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
- [ ] 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:
熊阔豪
2026-05-19 18:41:08 +08:00
committed by GitHub
parent 666ad5bfcf
commit 2ceda58d80
@@ -369,6 +369,7 @@ void boxFilter(InputArray _src, OutputArray _dst, int ddepth,
CV_INSTRUMENT_REGION();
CV_Assert(!_src.empty());
CV_Assert(ksize.width > 0 && ksize.height > 0);
CV_OCL_RUN(_dst.isUMat() &&
(borderType == BORDER_REPLICATE || borderType == BORDER_CONSTANT ||