Line | Count | Source |
1 | | /* |
2 | | # Copyright 2018 Google Inc. |
3 | | # |
4 | | # Licensed under the Apache License, Version 2.0 (the "License"); |
5 | | # you may not use this file except in compliance with the License. |
6 | | # You may obtain a copy of the License at |
7 | | # |
8 | | # http://www.apache.org/licenses/LICENSE-2.0 |
9 | | # |
10 | | # Unless required by applicable law or agreed to in writing, software |
11 | | # distributed under the License is distributed on an "AS IS" BASIS, |
12 | | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 | | # See the License for the specific language governing permissions and |
14 | | # limitations under the License. |
15 | | # |
16 | | ################################################################################ |
17 | | */ |
18 | | |
19 | | /* |
20 | | Usage: |
21 | | python infra/helper.py build_image kimageformats |
22 | | python infra/helper.py build_fuzzers --sanitizer undefined|address|memory kimageformats |
23 | | python infra/helper.py run_fuzzer kimageformats kimgio_[ani|avif|dds|exr|hdr|heif|jp2|jxl|jxr|kra|ora|pcx|pfm|pic|psd|pxr|qoi|ras|raw|rgb|sct|tga|xcf]_fuzzer |
24 | | */ |
25 | | |
26 | | |
27 | | #include <QBuffer> |
28 | | #include <QCoreApplication> |
29 | | #include <QImage> |
30 | | |
31 | | #include "ani_p.h" |
32 | | #include "avif_p.h" |
33 | | #include "dds_p.h" |
34 | | #include "exr_p.h" |
35 | | #include "hdr_p.h" |
36 | | #include "heif_p.h" |
37 | | #include "jp2_p.h" |
38 | | #include "jxl_p.h" |
39 | | #include "jxr_p.h" |
40 | | #include "kra.h" |
41 | | #include "ora.h" |
42 | | #include "qoi_p.h" |
43 | | #include "pcx_p.h" |
44 | | #include "pfm_p.h" |
45 | | #include "pic_p.h" |
46 | | #include "psd_p.h" |
47 | | #include "pxr_p.h" |
48 | | #include "ras_p.h" |
49 | | #include "raw_p.h" |
50 | | #include "rgb_p.h" |
51 | | #include "sct_p.h" |
52 | | #include "tga_p.h" |
53 | | #include "xcf_p.h" |
54 | | |
55 | | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
56 | 146k | { |
57 | 146k | int argc = 0; |
58 | 146k | QCoreApplication a(argc, nullptr); |
59 | | |
60 | 146k | QImageIOHandler* handler = new HANDLER(); |
61 | | |
62 | 146k | QImage i; |
63 | 146k | QBuffer b; |
64 | 146k | b.setData((const char *)data, size); |
65 | 146k | b.open(QIODevice::ReadOnly); |
66 | 146k | handler->setDevice(&b); |
67 | 146k | handler->canRead(); |
68 | 146k | handler->read(&i); |
69 | | |
70 | 146k | delete handler; |
71 | | |
72 | 146k | return 0; |
73 | 146k | } |