From 517bc1c777cd75f947e3ff705843bbbf5f331400 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Mon, 2 Mar 2026 18:13:34 +0100 Subject: [PATCH] Make sure j < maxRow in smooth functions Otherwise some values out of memory can be read. This was found with ASAN. --- modules/imgproc/src/smooth.simd.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/imgproc/src/smooth.simd.hpp b/modules/imgproc/src/smooth.simd.hpp index 4bbd7722e6..6509ab532b 100644 --- a/modules/imgproc/src/smooth.simd.hpp +++ b/modules/imgproc/src/smooth.simd.hpp @@ -620,6 +620,8 @@ void inline smooth3N121Impl(const ET* src, int cn, ET *dst, int ito, int idst, int len = (width - offset) * cn; int x = offset * cn; int maxRow = min((ito - vOffset),height-vOffset); + if (v >= maxRow) return; + #if (CV_SIMD || CV_SIMD_SCALABLE) VFT v_8 = vx_setall((WET)8); const int VECSZ = VTraits::vlanes(); @@ -713,6 +715,7 @@ void inline smooth5N14641Impl(const ET* src, int cn, ET* dst, int ito, int idst, int len = (width - offset) * cn; int x = offset * cn; int maxRow = min((ito - vOffset),height-vOffset); + if (v >= maxRow) return; #if (CV_SIMD || CV_SIMD_SCALABLE) VFT v_6 = vx_setall((WET)6);