This backports similar functionality from dav1d, from commits
35d1d011fda4a92bcaf42d30ed137583b27d7f6d and
d130da9c315d5a1d3968d278bbee2238ad9051e7.
This allows detecting writes out of bounds, on all 4 sides of
the intended destination rectangle.
The bounds checking also can optionally allow small overwrites
(up to a specified alignment), while still checking for larger
overwrites past the intended allowed region.
---
tests/checkasm/checkasm.c | 89 ++++++++++++++++++++++++++++++---------
tests/checkasm/checkasm.h | 55 ++++++++++++++++++++----
2 files changed, 116 insertions(+), 28 deletions(-)
diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index c6d641c52b..a5b862fe52 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -1168,37 +1168,88 @@ void checkasm_report(const char *name, ...)
}
}
+static int check_err(const char *file, int line,
+ const char *name, int w, int h,
+ int *err)
+{
+ if (*err)
+ return 0;
+ if (!checkasm_fail_func("%s:%d", file, line))
+ return 1;
+ *err = 1;
+ fprintf(stderr, "%s (%dx%d):\n", name, w, h);
+ return 0;
+}
+
#define DEF_CHECKASM_CHECK_FUNC(type, fmt) \
int checkasm_check_##type(const char *file, int line, \
const type *buf1, ptrdiff_t stride1, \
const type *buf2, ptrdiff_t stride2, \
- int w, int h, const char *name) \
+ int w, int h, const char *name, \
+ int align_w, int align_h, \
+ int padding) \
{ \