Skip to content

imgproc: Prevent 1B overrun of 8C3 SIMD optimization#16138

Merged
alalek merged 2 commits intoopencv:3.4from
pmur:reg_16137
Dec 12, 2019
Merged

imgproc: Prevent 1B overrun of 8C3 SIMD optimization#16138
alalek merged 2 commits intoopencv:3.4from
pmur:reg_16137

Conversation

@pmur
Copy link
Copy Markdown
Contributor

@pmur pmur commented Dec 12, 2019

resolves #16137

The fourth value read via v_load_q is essentially ignored,
but can cause trouble if it happens to cross page boundaries.

The final few iterations may attempt to read the most extreme
elements of S, which will read 1B beyond the array in most
alignment cases. Run theses in the scalar code to avoid the
above condition.

Likewise, cleanup the iteration increment statements to make
it more obvious they do channel count (3) elements per pass.

@pmur
Copy link
Copy Markdown
Contributor Author

pmur commented Dec 12, 2019

Actually, this may need to be little more dynamic depending on step size.

The fourth value read via v_load_q is essentially ignored,
but can cause trouble if it happens to cross page boundaries.

The final few iterations may attempt to read the most extreme
elements of S, which will read 1B beyond the array in most
aligment cases. Dynamically compute the stop. This could be
hoised from the loop, but will require a more extensive change.

Likewise, cleanup the iteration increment statements to make
it more obvious they do channel count (3) elements per pass.

This should resolve opencv#16137
Copy link
Copy Markdown
Member

@alalek alalek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick fix!

Validated 👍

@alalek alalek merged commit 1c4a64f into opencv:3.4 Dec 12, 2019
@alalek alalek mentioned this pull request Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants