1// These test checks that llvm-objdump will not crash with malformed Archive
2// files.  So the check line is not all that important but the bug fixes to
3// make sure llvm-objdump is robust is what matters.
4# RUN: not llvm-objdump --macho --archive-headers \
5# RUN:   %p/Inputs/libbogus1.a \
6# RUN:   2>&1 | FileCheck -check-prefix=bogus1 %s
7
8# bogus1: libbogus1.a': truncated or malformed archive (characters in size field in archive header are not all decimal numbers: '10%' for archive member header at offset 8)
9
10# RUN: not llvm-objdump --macho --archive-headers \
11# RUN:   %p/Inputs/libbogus2.a \
12# RUN:   2>&1 | FileCheck -check-prefix=bogus2 %s
13
14# bogus2: libbogus2.a': truncated or malformed archive (characters in size field in archive header are not all decimal numbers: '1%' for archive member header at offset 170)
15
16# RUN: not llvm-objdump --macho --archive-headers \
17# RUN:   %p/Inputs/libbogus3.a \
18# RUN:   2>&1 | FileCheck -check-prefix=bogus3 %s
19
20# bogus3: libbogus3.a': truncated or malformed archive (offset to next archive member past the end of the archive after member foo.c)
21
22# RUN: not llvm-objdump --macho --archive-headers \
23# RUN:   %p/Inputs/libbogus4.a \
24# RUN:   2>&1 | FileCheck -check-prefix=bogus4 %s
25
26# bogus4: libbogus4.a': truncated or malformed archive (remaining size of archive too small for next archive member header for foo.c)
27
28# RUN: not llvm-objdump --macho --archive-headers \
29# RUN:   %p/Inputs/libbogus5.a \
30# RUN:   2>&1 | FileCheck -check-prefix=bogus5 %s
31
32# bogus5: libbogus5.a': truncated or malformed archive (terminator characters in archive member "@\n" not the correct "`\n" values for the archive member header for hello.c)
33
34# RUN: not llvm-objdump --macho --archive-headers \
35# RUN:   %p/Inputs/libbogus6.a \
36# RUN:   2>&1 | FileCheck -check-prefix=bogus6 %s
37
38# bogus6: libbogus6.a': truncated or malformed archive (name contains a leading space for archive member header at offset 96)
39
40# RUN: not llvm-objdump --macho --archive-headers \
41# RUN:   %p/Inputs/libbogus7.a \
42# RUN:   2>&1 | FileCheck -check-prefix=bogus7 %s
43
44# bogus7: libbogus7.a': truncated or malformed archive (long name length characters after the #1/ are not all decimal numbers: '@123$' for archive member header at offset 8)
45
46# RUN: not llvm-objdump --macho --archive-headers \
47# RUN:   %p/Inputs/libbogus8.a \
48# RUN:   2>&1 | FileCheck -check-prefix=bogus8 %s
49
50# bogus8: libbogus8.a(<file index: 1>): truncated or malformed archive (long name length: 1234 extends past the end of the member or archive for archive member header at offset 86)
51
52# RUN: not llvm-objdump -s %p/Inputs/libbogus9.a \
53# RUN:   2>&1 | FileCheck -check-prefix=bogus9 %s
54
55# bogus9: libbogus9.a(<file index: 0>): truncated or malformed archive (long name offset characters after the '/' are not all decimal numbers: '&a25*' for archive member header at offset 94)
56
57# RUN: not llvm-objdump -s %p/Inputs/libbogus10.a \
58# RUN:   2>&1 | FileCheck -check-prefix=bogus10 %s
59
60# bogus10: libbogus10.a(<file index: 0>): truncated or malformed archive (long name offset 507 past the end of the string table for archive member header at offset 94)
61
62# RUN: not llvm-objdump --macho --archive-headers \
63# RUN:   %p/Inputs/libbogus11.a \
64# RUN:   2>&1 | FileCheck -check-prefix=bogus11 %s
65
66# bogus11: libbogus11.a(hello.c): truncated or malformed archive (characters in UID field in archive header are not all decimal numbers: '~97&' for the archive member header at offset 8)
67
68# RUN: not llvm-objdump --macho --archive-headers \
69# RUN:   %p/Inputs/libbogus12.a \
70# RUN:   2>&1 | FileCheck -check-prefix=bogus12 %s
71
72# bogus12: libbogus12.a(hello.c): truncated or malformed archive (characters in GID field in archive header are not all decimal numbers: '#55!' for the archive member header at offset 8)
73
74# RUN: not llvm-objdump --macho --archive-headers \
75# RUN:   %p/Inputs/libbogus13.a \
76# RUN:   2>&1 | FileCheck -check-prefix=bogus13 %s
77
78# bogus13: libbogus13.a(hello.c): truncated or malformed archive (characters in AccessMode field in archive header are not all decimal numbers: 'Feed' for the archive member header at offset 8)
79
80# RUN: llvm-objdump --macho --archive-headers %p/Inputs/libbogus14.a \
81# RUN:   2>&1 | FileCheck -check-prefix=bogus14 %s
82
83# bogus14: -rw-r--r--124/0     102 (date: "1foobar273" contains non-decimal chars) hello.c
84
85# RUN: not llvm-ar tv %p/Inputs/libbogus14.a \
86# RUN:   2>&1 | FileCheck -check-prefix=bogus14a %s
87
88# bogus14a: truncated or malformed archive (characters in LastModified field in archive header are not all decimal numbers: '1foobar273' for the archive member header at offset 8)
89