aboutsummaryrefslogtreecommitdiffstats
path: root/tests/checkasm/vf_nlmeans.c
diff options
context:
space:
mode:
authorClément Bœsch <u@pkh.me>2018-05-18 19:12:11 +0200
committerClément Bœsch <u@pkh.me>2018-05-18 19:12:11 +0200
commit2940af9389e5cb2a7509655195e5ccb928577ed2 (patch)
tree25312a3e4eefec923e0f0a67f92350d2ef98a0cf /tests/checkasm/vf_nlmeans.c
parenteb28b5ec8a21d1ac0d3752f81a187e20eb012016 (diff)
downloadffmpeg-2940af9389e5cb2a7509655195e5ccb928577ed2.tar.gz
tests/checkasm/nlmeans: fix invalid read/write on ii buffer
Diffstat (limited to 'tests/checkasm/vf_nlmeans.c')
-rw-r--r--tests/checkasm/vf_nlmeans.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/checkasm/vf_nlmeans.c b/tests/checkasm/vf_nlmeans.c
index 5e2c934226..32c6931a4b 100644
--- a/tests/checkasm/vf_nlmeans.c
+++ b/tests/checkasm/vf_nlmeans.c
@@ -80,8 +80,8 @@ void checkasm_check_nlmeans(void)
av_assert0(startx_safe - s2x >= 0); av_assert0(startx_safe - s2x < w);
av_assert0(starty_safe - s2y >= 0); av_assert0(starty_safe - s2y < h);
- memset(ii_ref, 0, ii_lz_32 * ii_h * sizeof(*ii_ref));
- memset(ii_new, 0, ii_lz_32 * ii_h * sizeof(*ii_new));
+ memset(ii_ref, 0, (ii_lz_32 * ii_h - 1) * sizeof(*ii_ref));
+ memset(ii_new, 0, (ii_lz_32 * ii_h - 1) * sizeof(*ii_new));
call_ref(ii_ref + starty_safe*ii_lz_32 + startx_safe, ii_lz_32,
src + (starty_safe - s1y) * src_lz + (startx_safe - s1x), src_lz,
@@ -92,10 +92,10 @@ void checkasm_check_nlmeans(void)
src + (starty_safe - s2y) * src_lz + (startx_safe - s2x), src_lz,
safe_pw, safe_ph);
- if (memcmp(ii_ref, ii_new, ii_h * ii_lz_32 * 4))
+ if (memcmp(ii_ref, ii_new, (ii_lz_32 * ii_h - 1) * sizeof(*ii_ref)))
fail();
- memset(ii_new, 0, ii_lz_32 * ii_h * sizeof(*ii_new));
+ memset(ii_new, 0, (ii_lz_32 * ii_h - 1) * sizeof(*ii_new));
bench_new(ii_new + starty_safe*ii_lz_32 + startx_safe, ii_lz_32,
src + (starty_safe - s1y) * src_lz + (startx_safe - s1x), src_lz,
src + (starty_safe - s2y) * src_lz + (startx_safe - s2x), src_lz,