xref: /aosp_15_r20/external/emboss/testdata/complex_structure.emb (revision 99e0aae7469b87d12f0ad23e61142c2d74c1ef70)
1# Copyright 2019 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#     https://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15-- Relatively complex structure intended for use in fuzz testing.
16--
17-- Note that field names are intentionally very short; this helps American
18-- Fuzzy Lop (go/afl) find new code paths more quickly.
19
20[$default byte_order: "LittleEndian"]
21[(cpp) namespace: "emboss_test"]
22
23
24bits RegisterLayout:
25  0 [+8]  Int   x
26  0 [+4]  UInt  l
27  4 [+4]  UInt  h
28
29
30struct ArrayElement:
31  0 [+1]  RegisterLayout  a
32
33
34struct Complex:
35  0 [+1]         UInt               s
36  1 [+8]         UInt               u
37  1 [+8]         Int                i
38  1 [+8]         Bcd                b
39  1 [+s*4]       ArrayElement[4][]  a
40  1 [+1]  bits:
41    0 [+8]       UInt               a0
42    7 [+1]       Flag               s0
43    0 [+4]       Int                l0
44    4 [+4]       Int                h0
45
46  2 [+1]         ArrayElement       e1
47  if a0 >= 0x80:
48    3 [+1]       ArrayElement       e2
49
50  if a0 < 0x80:
51    3 [+1]       Bcd                b2
52
53  if b2 > 25:
54    4 [+1]       Int                e3
55
56  if s >= 4 && (a0 >= 80 ? e3 >= 0x80 : b2 < 50):
57    5 [+1]       Int                e4
58
59  if s >= 5 && e4 > 0:
60    6 [+1]       Int                e5
61
62  if s < 2 || a0 < 4:
63    1 [+1]       Int                e0
64