mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
357ad24262
fix: Guard ndsrvp filter center copy when source span is empty #28915 ## Summary This adds a defensive guard around the centre-region `memcpy` in the ndsrvp HAL filter padding path. **Description**: Multiple memcpy calls in the ndsrvp HAL filter, bilateral filter, and median blur routines use computed sizes (e.g., cnes * (rborder - j), cn * (rborder - j), src_step * height) without validating that the computed byte count fits within the destination buffer. An attacker supplying a crafted image with manipulated dimensions, channel counts, or border parameters can cause the computed copy size to exceed the allocated destination buffer, resulting in a heap buffer overflow that corrupts adjacent memory. ## Changes - `hal/ndsrvp/src/filter.cpp` ## Verification - [x] Build passes - [x] Scanner re-scan confirms fix - [x] LLM code review passed --- *Automated security fix by [OrbisAI Security](https://orbisappsec.com)*