[ld, testsuite] Don't print to stdout for "readelf -w" to avoid buffer overflow
authorJiong Wang <jiong.wang@arm.com>
Thu, 2 Feb 2017 17:15:26 +0000 (17:15 +0000)
committerJiong Wang <jiong.wang@arm.com>
Mon, 6 Feb 2017 15:25:18 +0000 (15:25 +0000)
ld/
* testsuite/ld-elf/compress.exp: Don't print to stdout for all
"readelf -w".

ld/ChangeLog
ld/testsuite/ld-elf/compress.exp

index ba4de4a35ee331696386a27abcf31130fa363ec1..681a0d767c450a856b27150153cca1f557c56e75 100644 (file)
@@ -1,3 +1,8 @@
+2017-02-06  Jiong Wang  <jiong.wang@arm.com>
+
+       * testsuite/ld-elf/compress.exp: Don't print to stdout for all
+       "readelf -w".
+
 2017-02-02  Maciej W. Rozycki  <macro@imgtec.com>
 
        * testsuite/ld-cris/tls-err-20x.d: Fix a typo, s/n/\n/.
index 5620f3ca4bfe8764a27debf60df833973b818ae7..3fb4bd794bdd9650fd6ee1dcfac89bf404504b2f 100644 (file)
@@ -171,7 +171,7 @@ if { [regexp_diff tmpdir/$test.out $srcdir/$subdir/$test.rt] } then {
 set test_name "Link with zlib compressed debug output"
 set test normal
 send_log "$READELF -w tmpdir/$test > tmpdir/$test.out\n"
-set got [remote_exec host "$READELF -w tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"]
+set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"]
 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
     send_log "$got\n"
     unresolved "$test_name"
@@ -180,7 +180,7 @@ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
 set test_name "Link with zlib compressed debug output"
 set test zlibnormal
 send_log "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n"
-set got [remote_exec host "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\"" "" "/dev/null" "tmpdir/$test.out"]
+set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"]
 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
     send_log "$got\n"
     unresolved "$test_name"
@@ -206,7 +206,7 @@ if { [regexp_diff tmpdir/$test.out $srcdir/$subdir/$test.rS] } then {
 set test_name "Link with zlib-gnu compressed debug output"
 set test gnunormal
 send_log "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out\n"
-set got [remote_exec host "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\"" "" "/dev/null" "tmpdir/$test.out"]
+set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test | sed -e \"s/.zdebug_/.debug_/\" > tmpdir/$test.out"]] "" "/dev/null"]
 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
     send_log "$got\n"
     unresolved "$test_name"
@@ -232,7 +232,7 @@ if { [regexp_diff tmpdir/$test.out $srcdir/$subdir/$test.rS] } then {
 set test gabinormal
 set test_name "Link with zlib-gabi compressed debug output"
 send_log "$READELF -w tmpdir/$test > tmpdir/$test.out\n"
-set got [remote_exec host "$READELF -w tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"]
+set got [remote_exec host [concat sh -c [list "$READELF -w tmpdir/$test > tmpdir/$test.out"]] "" "/dev/null"]
 if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
     send_log "$got\n"
     unresolved "$test_name"