xref: /qemu/tests/qtest/fuzz-xlnx-dp-test.c (revision 29b62a10)
1 /*
2  * QTest fuzzer-generated testcase for xlnx-dp display device
3  *
4  * Copyright (c) 2021 Qiang Liu <cyruscyliu@gmail.com>
5  *
6  * SPDX-License-Identifier: GPL-2.0-or-later
7  */
8 
9 #include "qemu/osdep.h"
10 #include "libqtest.h"
11 
12 /*
13  * This used to trigger the out-of-bounds read in xlnx_dp_read
14  */
15 static void test_fuzz_xlnx_dp_0x3ac(void)
16 {
17     QTestState *s = qtest_init("-M xlnx-zcu102 ");
18     qtest_readl(s, 0xfd4a03ac);
19     qtest_quit(s);
20 }
21 
22 int main(int argc, char **argv)
23 {
24     const char *arch = qtest_get_arch();
25 
26     g_test_init(&argc, &argv, NULL);
27 
28    if (strcmp(arch, "aarch64") == 0) {
29         qtest_add_func("fuzz/test_fuzz_xlnx_dp/3ac", test_fuzz_xlnx_dp_0x3ac);
30    }
31 
32    return g_test_run();
33 }
34