/src/poppler/glib/tests/fuzzing/util_fuzzer.cc
Line | Count | Source |
1 | | #include <stdlib.h> |
2 | | #include <stdint.h> |
3 | | #include <string.h> |
4 | | #include <poppler.h> |
5 | | |
6 | | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
7 | 91 | { |
8 | 91 | char *tmp_ch; |
9 | 91 | char *buf; |
10 | 91 | gsize length; |
11 | 91 | guint8 *tmp_uint; |
12 | | |
13 | 91 | buf = (char *)calloc(size + 1, sizeof(char)); |
14 | 91 | memcpy(buf, data, size); |
15 | 91 | buf[size] = '\0'; |
16 | | |
17 | 91 | tmp_ch = poppler_named_dest_from_bytestring((const guint8 *)buf, size); |
18 | 91 | tmp_uint = poppler_named_dest_to_bytestring(buf, &length); |
19 | | |
20 | 91 | g_free(tmp_ch); |
21 | 91 | g_free(tmp_uint); |
22 | 91 | free(buf); |
23 | 91 | return 0; |
24 | 91 | } |