xref: /aosp_15_r20/external/pdfium/testing/fuzzers/pdf_fuzzer_templates.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2021 The PDFium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 // File for holding strings representing PDF templates that are used by fuzzers.
6 
7 #ifndef TESTING_FUZZERS_PDF_FUZZER_TEMPLATES_H_
8 #define TESTING_FUZZERS_PDF_FUZZER_TEMPLATES_H_
9 
10 constexpr char kSimplePdfTemplate[] = R"(%PDF-1.7
11 1 0 obj
12 <</Type /Catalog /Pages 2 0 R /AcroForm <</XFA 30 0 R>> /NeedsRendering true>>
13 endobj
14 2 0 obj
15 <</Type /Pages /Kids [3 0 R] /Count 1>>
16 endobj
17 3 0 obj
18 <</Type /Page /Parent 2 0 R /MediaBox [0 0 3 3]>>
19 endobj
20 30 0 obj
21 <</Length $1>>
22 stream
23 $2
24 endstream
25 endobj
26 trailer
27 <</Root 1 0 R /Size 31>>
28 %%EOF)";
29 
30 // We define the bytes of the header explicitly to make the values more readable
31 constexpr uint8_t kSimplePdfHeader[] = {0x25, 0x50, 0x44, 0x46, 0x2d,
32                                         0x31, 0x2e, 0x37, 0x0a, 0x25,
33                                         0xa0, 0xf2, 0xa4, 0xf4, 0x0a};
34 
35 constexpr char kCatalog[] = R""(<</AcroForm 2 0 R /Extensions
36   <</ADBE <</BaseVersion /1.7 /ExtensionLevel 8>>>> /NeedsRendering true
37   /Pages 3 0 R /Type /Catalog>>)"";
38 
39 constexpr char kSimpleXfaObjWrapper[] = R""(<</XFA
40   [(preamble) 5 0 R ($1) 6 0 R ($2) 7 0 R ($3) 8 0 R
41   (postamble) 9 0 R]>>)"";
42 
43 constexpr char kSimplePagesObj[] = "<</Count 1 /Kids [4 0 R] /Type /Pages>>";
44 constexpr char kSimplePageObj[] =
45     "<</MediaBox [0 0 612 792] /Parent 3 0 R /Type /Page>>";
46 constexpr char kSimplePreamble[] =
47     R""(<xdp:xdp xmlns:xdp="http://ns.adobe.com/xdp/"
48 timeStamp="2021-12-14T14:14:14Z"
49 uuid="11111111-1ab1-11b1-aa1a-1aaaaaaa11a1">)"";
50 constexpr char kSimplePostamble[] = "</xdp:xdp>";
51 
52 #endif  // TESTING_FUZZERS_PDF_FUZZER_TEMPLATES_H_
53