diff --git a/terminal/bidi_test.c b/terminal/bidi_test.c index 0b63029f..1acd1d68 100644 --- a/terminal/bidi_test.c +++ b/terminal/bidi_test.c @@ -44,7 +44,8 @@ static void run_test(const char *filename, unsigned lineno, { size_t bcs_orig_len = bcs_len; bidi_char *bcs_orig = snewn(bcs_orig_len, bidi_char); - memcpy(bcs_orig, bcs, bcs_orig_len * sizeof(bidi_char)); + if (bcs_orig_len) + memcpy(bcs_orig, bcs, bcs_orig_len * sizeof(bidi_char)); bcs_len = do_bidi_test(ctx, bcs, bcs_len, override); @@ -335,6 +336,12 @@ int main(int argc, char **argv) } else { const char *filename = arg; + if (!testfn) { + fprintf(stderr, "no mode argument provided before filename " + "'%s'\n", filename); + return 1; + } + if (!strcmp(filename, "-")) { testfn("", stdin); } else {