Skip to content

Commit

Permalink
Merge pull request opencv#21779 from eplankin:fix_11303
Browse files Browse the repository at this point in the history
Fixed out-of-bounds read in parallel version of ippGaussianBlur()

* Fixed out-of-memory read in parallel version of ippGaussianBlur()

* Fixed check

* Revert changes in CMakeLists.txt
  • Loading branch information
eplankin authored Apr 5, 2022
1 parent 84b4a5a commit d793ec2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/imgproc/src/smooth.dispatch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ static bool ipp_GaussianBlur(InputArray _src, OutputArray _dst, Size ksize,
if (IPP_DISABLE_GAUSSIAN_BLUR_32FC4_1TH && (threads == 1 && src.type() == CV_32FC4))
return false;

if(IPP_GAUSSIANBLUR_PARALLEL && threads > 1) {
if(IPP_GAUSSIANBLUR_PARALLEL && threads > 1 && iwSrc.m_size.height/(threads * 4) >= ksize.height/2) {
bool ok;
ipp_gaussianBlurParallel invoker(iwSrc, iwDst, ksize.width, (float) sigma1, ippBorder, &ok);

Expand Down
11 changes: 11 additions & 0 deletions modules/imgproc/test/test_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2355,5 +2355,16 @@ TEST(Imgproc, filter_empty_src_16857)
EXPECT_TRUE(dst2.empty());
}

TEST(Imgproc_GaussianBlur, regression_11303)
{
cv::Mat dst;
int width = 2115;
int height = 211;
double sigma = 8.64421;
cv::Mat src(cv::Size(width, height), CV_32F, 1);
cv::GaussianBlur(src, dst, cv::Size(), sigma, sigma);
EXPECT_LE(cv::norm(src, dst, NORM_L2), 1e-3);
}


}} // namespace

0 comments on commit d793ec2

Please sign in to comment.