@@ -21,6 +21,67 @@ TEST_CASES="invalid-shrstrtab-idx invalid-shrstrtab-size invalid-shrstrtab-zero
21
21
# Issue #64 regression test. Test ELF provided by issue submitter.
22
22
TEST_CASES=$TEST_CASES ' invalid-phdr-issue-64'
23
23
24
+ # Issue #132 regression test. Test ELF provided by issue submitter.
25
+ TEST_CASES=$TEST_CASES ' invalid-shrink-rpath-issue-132'
26
+
27
+ # Issue #133 regression test. Test ELFs provided by issue submitter.
28
+ set -x
29
+ for i in $( seq 0 5) ; do
30
+ # Not yet fixed!
31
+ if [ " $i " == 3 ]; then continue ; fi
32
+ TEST_CASES=$TEST_CASES ' invalid-strlen-issue-133-' $i
33
+ done
34
+ set +x
35
+
36
+ # Issue #134 regression test. Test ELFs provided by issue submitter.
37
+ set -x
38
+ for i in $( seq 0 1) ; do
39
+ TEST_CASES=$TEST_CASES ' invalid-null-ptr-issue-134-' $i
40
+ done
41
+ set +x
42
+
43
+ # Not yet fixed!
44
+ # Issue #132 regression test. Test ELF provided by issue submitter.
45
+ # TEST_CASES=$TEST_CASES' invalid-string-index-issue-135'
46
+
47
+ # Some ELFs are immediately recognized as invalid. Others, we need to
48
+ # attempt an operation to notice the problem.
49
+
50
+ # shellcheck disable=SC2034
51
+ invalid_shrstrtab_idx_CMDS=' '
52
+ # shellcheck disable=SC2034
53
+ invalid_shrstrtab_size_CMDS=' '
54
+ # shellcheck disable=SC2034
55
+ invalid_shrstrtab_zero_CMDS=' '
56
+ # shellcheck disable=SC2034
57
+ invalid_shrstrtab_nonterm_CMDS=' '
58
+ # shellcheck disable=SC2034
59
+ invalid_shdr_name_CMDS=' '
60
+ # shellcheck disable=SC2034
61
+ invalid_phdr_offset_CMDS=' '
62
+ # shellcheck disable=SC2034
63
+ invalid_phdr_issue_64_CMDS=' '
64
+ # shellcheck disable=SC2034
65
+ invalid_shrink_rpath_issue_132_CMDS=' --shrink-rpath'
66
+ # shellcheck disable=SC2034
67
+ invalid_strlen_issue_133_0_CMDS=' --shrink-rpath'
68
+ # shellcheck disable=SC2034
69
+ invalid_strlen_issue_133_1_CMDS=' --shrink-rpath'
70
+ # shellcheck disable=SC2034
71
+ invalid_strlen_issue_133_2_CMDS=' --shrink-rpath'
72
+ # shellcheck disable=SC2034
73
+ invalid_strlen_issue_133_3_CMDS=' --shrink-rpath'
74
+ # shellcheck disable=SC2034
75
+ invalid_strlen_issue_133_4_CMDS=' --shrink-rpath'
76
+ # shellcheck disable=SC2034
77
+ invalid_strlen_issue_133_5_CMDS=' --shrink-rpath'
78
+ # shellcheck disable=SC2034
79
+ invalid_null_ptr_issue_134_0_CMDS=' --shrink-rpath'
80
+ # shellcheck disable=SC2034
81
+ invalid_null_ptr_issue_134_1_CMDS=' --shrink-rpath'
82
+ # shellcheck disable=SC2034
83
+ invalid_string_index_issue_135_CMDS=' --shrink-rpath'
84
+
24
85
# shellcheck disable=SC2034
25
86
invalid_shrstrtab_idx_MSG=' data region extends past file end'
26
87
# shellcheck disable=SC2034
@@ -35,24 +96,53 @@ invalid_shdr_name_MSG='data region extends past file end'
35
96
invalid_phdr_offset_MSG=' data region extends past file end'
36
97
# shellcheck disable=SC2034
37
98
invalid_phdr_issue_64_MSG=' program header table out of bounds'
99
+ # shellcheck disable=SC2034
100
+ invalid_shrink_rpath_issue_132_MSG=' data region extends past file end'
101
+ # shellcheck disable=SC2034
102
+ invalid_strlen_issue_133_0_MSG=' section name offset out of bounds'
103
+ # shellcheck disable=SC2034
104
+ invalid_strlen_issue_133_1_MSG=' data region extends past file end'
105
+ # shellcheck disable=SC2034
106
+ invalid_strlen_issue_133_2_MSG=' string table is not zero terminated'
107
+ # shellcheck disable=SC2034
108
+ invalid_strlen_issue_133_3_MSG=' not sure yet'
109
+ # shellcheck disable=SC2034
110
+ invalid_strlen_issue_133_4_MSG=' data region extends past file end'
111
+ # shellcheck disable=SC2034
112
+ invalid_strlen_issue_133_5_MSG=' string table size is zero'
113
+ # shellcheck disable=SC2034
114
+ invalid_null_ptr_issue_134_0_MSG=' no section headers'
115
+ # shellcheck disable=SC2034
116
+ invalid_null_ptr_issue_134_1_MSG=' no section headers'
117
+ # shellcheck disable=SC2034
118
+ invalid_string_index_issue_135_MSG=' no sure yet'
38
119
39
120
FAILED_TESTS=" "
40
121
41
122
for tcase in $TEST_CASES ; do
42
123
if [ ! -r " $TEST_DIR /$tcase " ]; then
43
- echo " Cannot read test case: $tcase "
44
- exit 1
124
+ echo " Cannot read test case: $tcase "
125
+ exit 1
45
126
fi
46
127
47
- ../src/patchelf --output /dev/null " $TEST_DIR /$tcase " && res=$? || res=$?
128
+ var=$( echo " $tcase -CMDS" | tr ' -' ' _' )
129
+ cmds=
130
+ eval " cmds=\$ {$var }"
131
+
132
+ # Want the word-splitting, no arrays in POSIX shell
133
+ # shellcheck disable=SC2086
134
+ ../src/patchelf $cmds --output /dev/null " $TEST_DIR /$tcase " && res=$? || res=$?
48
135
if killed_by_signal " $res " ; then
49
- FAILED_TESTS=" $FAILED_TESTS $tcase "
136
+ FAILED_TESTS=" $FAILED_TESTS $tcase "
50
137
fi
51
138
52
139
var=$( echo " $tcase -MSG" | tr ' -' ' _' )
53
140
msg=
54
141
eval " msg=\$ {$var }"
55
- ../src/patchelf --output /dev/null " $TEST_DIR /$tcase " 2>&1 |
142
+
143
+ # Want the word-splitting, no arrays in POSIX shell
144
+ # shellcheck disable=SC2086
145
+ ../src/patchelf $cmds --output /dev/null " $TEST_DIR /$tcase " 2>&1 |
56
146
grep " $msg " > /dev/null 2> /dev/null
57
147
done
58
148
0 commit comments