Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check image dimension in vpImageFilter::gaussianBlur function #1535

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions modules/core/src/image/vpImageFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,13 @@
void vpImageFilter::gaussianBlur(const vpImage<vpRGBa> &I, vpImage<vpRGBa> &GI, unsigned int size, double sigma, bool normalize,
const vpImage<bool> *p_mask)
{
if (size-1 > I.getWidth() || size-1 > I.getHeight()) {
std::ostringstream oss;

Check warning on line 324 in modules/core/src/image/vpImageFilter.cpp

View check run for this annotation

Codecov / codecov/patch

modules/core/src/image/vpImageFilter.cpp#L324

Added line #L324 was not covered by tests
oss << "Image size (" << I.getWidth() << "x" << I.getHeight() << ") is too small for the Gaussian kernel ("
<< "size=" << size << "), min size is " << (size-1);
throw vpException(vpException::dimensionError, oss.str());
}

Check warning on line 328 in modules/core/src/image/vpImageFilter.cpp

View check run for this annotation

Codecov / codecov/patch

modules/core/src/image/vpImageFilter.cpp#L327-L328

Added lines #L327 - L328 were not covered by tests

double *fg = new double[(size + 1) / 2];
vpImageFilter::getGaussianKernel(fg, size, sigma, normalize);
vpImage<vpRGBa> GIx;
Expand Down
Loading