Discussion:
[ast-developers] tr -Cd crashes when binary is used
ольга крыжановская
2013-03-12 11:44:32 UTC
Permalink
Glenn, tr -Cd from ast-ksh.20130222 crashes when it has to delete binary data.

Test case is below, using Roland's 64bit build, with /usr/bin/arch,
how ever any long binary from /usr/bin should suffice:
gdb --args ~/bin/ksh -c 'builtin tr ; tr -cd "[:print:]" </usr/bin/arch ; print'
GNU gdb (GDB) SUSE (7.4.50.20120603-2.1.2)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/test001/bin/ksh...done.
(gdb) run
Starting program: /home/test001/bin/ksh -c builtin\ tr\ \;\ tr\ -cd\
\"\[:print:\]\"\ \</usr/bin/arch\ \;\ print

Program received signal SIGSEGV, Segmentation fault.
0x0000000000561075 in trcopy (tr=0x7ffff6ef0050, ip=0x7f3ea0
<_Sfstdin>, op=0x7f3f60 <_Sfstdout>, ncopy=-1)
at /home/test001/work/ast_ksh_20130222/build_i386_64bit_debug/src/lib/libcmd/tr.c:663
663 w = code[w];
Missing separate debuginfos, use: zypper install
glibc-debuginfo-2.15-22.17.1.x86_64
(gdb) print
$1 = 1073741825 L'\x40000001'
(gdb) print *tr
$3 = {context = 0x7f6948 <sh+1352>, convert = 0, count = 0, prev = -1,
last = -1, level = 0, mb = 1, position = 0, src = 876051, dst =
876051, type = 1, truncate64 = 0,
chars = 1114112, warn = 1, isit = 0x0, base = 0x0, next = 0x0, hold
= 0x7ffff7fc274b "\"", code = {1073741824}}

Olga
--
, _ _ ,
{ \/`o;====- Olga Kryzhanovska -====;o`\/ }
.----'-/`-/ olga.kryzhanovska at gmail.com \-`\-'----.
`'-..-| / http://twitter.com/fleyta \ |-..-'`
/\/\ Solaris/BSD//C/C++ programmer /\/\
`--` `--`
Cedric Blancher
2013-04-04 10:21:32 UTC
Permalink
Post by ольга крыжановская
Glenn, tr -Cd from ast-ksh.20130222 crashes when it has to delete binary data.
Test case is below, using Roland's 64bit build, with /usr/bin/arch,
gdb --args ~/bin/ksh -c 'builtin tr ; tr -cd "[:print:]" </usr/bin/arch ; print'
GNU gdb (GDB) SUSE (7.4.50.20120603-2.1.2)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/test001/bin/ksh...done.
(gdb) run
Starting program: /home/test001/bin/ksh -c builtin\ tr\ \;\ tr\ -cd\
\"\[:print:\]\"\ \</usr/bin/arch\ \;\ print
Program received signal SIGSEGV, Segmentation fault.
0x0000000000561075 in trcopy (tr=0x7ffff6ef0050, ip=0x7f3ea0
<_Sfstdin>, op=0x7f3f60 <_Sfstdout>, ncopy=-1)
at /home/test001/work/ast_ksh_20130222/build_i386_64bit_debug/src/lib/libcmd/tr.c:663
663 w = code[w];
Missing separate debuginfos, use: zypper install
glibc-debuginfo-2.15-22.17.1.x86_64
(gdb) print
$1 = 1073741825 L'\x40000001'
(gdb) print *tr
$3 = {context = 0x7f6948 <sh+1352>, convert = 0, count = 0, prev = -1,
last = -1, level = 0, mb = 1, position = 0, src = 876051, dst =
876051, type = 1, truncate64 = 0,
chars = 1114112, warn = 1, isit = 0x0, base = 0x0, next = 0x0, hold
= 0x7ffff7fc274b "\"", code = {1073741824}}
Olga
failing for me, too.

Glenn, can you look after this problem for the next alpha, please?

Ced
--
Cedric Blancher <cedric.blancher at googlemail.com>
Institute Pasteur
Glenn Fowler
2013-04-04 17:54:38 UTC
Permalink
we just got a sol11.i386-64 online and can reproduce the problem
Post by Cedric Blancher
Post by ольга крыжановская
Glenn, tr -Cd from ast-ksh.20130222 crashes when it has to delete binary data.
Test case is below, using Roland's 64bit build, with /usr/bin/arch,
gdb --args ~/bin/ksh -c 'builtin tr ; tr -cd "[:print:]" </usr/bin/arch ; print'
GNU gdb (GDB) SUSE (7.4.50.20120603-2.1.2)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/test001/bin/ksh...done.
(gdb) run
Starting program: /home/test001/bin/ksh -c builtin\ tr\ \;\ tr\ -cd\
\"\[:print:\]\"\ \</usr/bin/arch\ \;\ print
Program received signal SIGSEGV, Segmentation fault.
0x0000000000561075 in trcopy (tr=0x7ffff6ef0050, ip=0x7f3ea0
<_Sfstdin>, op=0x7f3f60 <_Sfstdout>, ncopy=-1)
at /home/test001/work/ast_ksh_20130222/build_i386_64bit_debug/src/lib/libcmd/tr.c:663
663 w = code[w];
Missing separate debuginfos, use: zypper install
glibc-debuginfo-2.15-22.17.1.x86_64
(gdb) print
$1 = 1073741825 L'\x40000001'
(gdb) print *tr
$3 = {context = 0x7f6948 <sh+1352>, convert = 0, count = 0, prev = -1,
last = -1, level = 0, mb = 1, position = 0, src = 876051, dst =
876051, type = 1, truncate64 = 0,
chars = 1114112, warn = 1, isit = 0x0, base = 0x0, next = 0x0, hold
= 0x7ffff7fc274b "\"", code = {1073741824}}
Olga
failing for me, too.
Glenn, can you look after this problem for the next alpha, please?
Cedric Blancher
2013-07-22 10:14:47 UTC
Permalink
Post by Glenn Fowler
we just got a sol11.i386-64 online and can reproduce the problem
This crashes even on Linux.

ksh -c 'builtin tr ; tr --version'
version tr (AT&T Research) 2013-07-17
Post by Glenn Fowler
Post by Cedric Blancher
Post by ольга крыжановская
Glenn, tr -Cd from ast-ksh.20130222 crashes when it has to delete binary data.
Test case is below, using Roland's 64bit build, with /usr/bin/arch,
gdb --args ~/bin/ksh -c 'builtin tr ; tr -cd "[:print:]" </usr/bin/arch ; print'
GNU gdb (GDB) SUSE (7.4.50.20120603-2.1.2)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/test001/bin/ksh...done.
(gdb) run
Starting program: /home/test001/bin/ksh -c builtin\ tr\ \;\ tr\ -cd\
\"\[:print:\]\"\ \</usr/bin/arch\ \;\ print
Program received signal SIGSEGV, Segmentation fault.
0x0000000000561075 in trcopy (tr=0x7ffff6ef0050, ip=0x7f3ea0
<_Sfstdin>, op=0x7f3f60 <_Sfstdout>, ncopy=-1)
at /home/test001/work/ast_ksh_20130222/build_i386_64bit_debug/src/lib/libcmd/tr.c:663
663 w = code[w];
Missing separate debuginfos, use: zypper install
glibc-debuginfo-2.15-22.17.1.x86_64
(gdb) print
$1 = 1073741825 L'\x40000001'
(gdb) print *tr
$3 = {context = 0x7f6948 <sh+1352>, convert = 0, count = 0, prev = -1,
last = -1, level = 0, mb = 1, position = 0, src = 876051, dst =
876051, type = 1, truncate64 = 0,
chars = 1114112, warn = 1, isit = 0x0, base = 0x0, next = 0x0, hold
= 0x7ffff7fc274b "\"", code = {1073741824}}
Olga
failing for me, too.
Glenn, can you look after this problem for the next alpha, please?
Ced
--
Cedric Blancher <cedric.blancher at gmail.com>
Institute Pasteur
Loading...