• A. Wilcox's avatar
    system/ruby: libedit compatibility patch [read:] · ee8cd5c2
    A. Wilcox authored
    Ruby pretends editline (libedit) is readline.  This is normally fine.
    However, editline's readline emulation does not account for changes to
    rl_instream or rl_outstream.  If a Ruby application using the Readline
    extension changes .input or .output, this will cause a use-after-free:
    
    ==32694== Invalid read of size 4
    ==32694==    at 0x4070A38: fwrite (fwrite.c:32)
    ==32694==    by 0x406F707: fputs (fputs.c:7)
    ==32694==    by 0x660EAC7: el_wgets (in /usr/lib/libedit.so.0.0.60)
    ==32694==    by 0x6607BDB: el_gets (in /usr/lib/libedit.so.0.0.60)
    ==32694==    by 0x6620EDB: readline (in /usr/lib/libedit.so.0.0.60)
    ==32694==    by 0x65DE3D3: readline_get (readline.c:346)
    ==32694==    by 0x4DFA49B: rb_protect (eval.c:996)
    ==32694==    by 0x65DE4FF: readline_readline (readline.c:507)
    ==32694==    by 0x4F7AD4B: call_cfunc_m1 (vm_insnhelper.c:1723)
    ==32694==  Address 0x67503dc is 140 bytes inside a block of size 1,264 free'd
    ==32694==    at 0x490AFC0: free (in /usr/lib/valgrind/vgpreload_memcheck-ppc64be-linux.so)
    ==32694==    by 0x406D44F: fclose (fclose.c:35)
    ==32694==    by 0x65DE013: clear_rl_outstream (readline.c:365)
    ==32694==    by 0x65DE0DF: readline_s_set_output (readline.c:599)
    ==32694==  Block was alloc'd at
    ==32694==    at 0x49092C0: malloc (in /usr/lib/valgrind/vgpreload_memcheck-ppc64be-linux.so)
    ==32694==    by 0x406BEC7: fdopen (__fdopen.c:21)
    ==32694==    by 0x65DE103: readline_s_set_output (readline.c:603)
    
    Since rl_instream and rl_outstream are read on each rl_initialize, and
    editline's rl_initialize is smart enough to not leak memory if it is
    called multiple times during program execution, we use this as a way to
    force re-reading of rl_instream and rl_outstream.
    
    I hate this patch; I really do.  Better fixes are highly welcome.
    ee8cd5c2
Name
Last commit
Last update
..
abuild Loading commit data...
acl Loading commit data...
adelie-base Loading commit data...
adelie-keys Loading commit data...
apk-tools Loading commit data...
argon2 Loading commit data...
asciidoctor Loading commit data...
at Loading commit data...
atf Loading commit data...
attr Loading commit data...
autoconf Loading commit data...
automake Loading commit data...
bash Loading commit data...
bc Loading commit data...
binutils Loading commit data...
bison Loading commit data...
bsd-compat-headers Loading commit data...
bubblewrap Loading commit data...
build-tools Loading commit data...
byacc Loading commit data...
bzip2 Loading commit data...
ca-certificates Loading commit data...
cflow Loading commit data...
check Loading commit data...
cmake Loading commit data...
console-setup Loading commit data...
coreutils Loading commit data...
cryptsetup Loading commit data...
curl Loading commit data...
cvs Loading commit data...
cxref Loading commit data...
dash Loading commit data...
db Loading commit data...
debianutils Loading commit data...
dejagnu Loading commit data...
diffutils Loading commit data...
docbook-xml Loading commit data...
docbook-xsl Loading commit data...
e2fsprogs Loading commit data...
easy-kernel Loading commit data...
easy-kernel-power8 Loading commit data...
easy-kernel-power8-64k Loading commit data...
ed Loading commit data...
execline Loading commit data...
expat Loading commit data...
expect Loading commit data...
fakeroot Loading commit data...
fcron Loading commit data...
file Loading commit data...
findutils Loading commit data...
flex Loading commit data...
gcc Loading commit data...
gdb Loading commit data...
gettext-tiny Loading commit data...
gettys-openrc Loading commit data...
git Loading commit data...
gmp Loading commit data...
grep Loading commit data...
groff Loading commit data...
gzip Loading commit data...
heirloom-devtools Loading commit data...
heirloom-pax Loading commit data...
help2man Loading commit data...
icu Loading commit data...
iproute2 Loading commit data...
isl Loading commit data...
jfsutils Loading commit data...
json-c Loading commit data...
kbd Loading commit data...
kmod Loading commit data...
kyua Loading commit data...
lddtree Loading commit data...
less Loading commit data...
libaio Loading commit data...
libarchive Loading commit data...
libcap Loading commit data...
libcap-ng Loading commit data...
libedit Loading commit data...
libelf Loading commit data...
libffi Loading commit data...
libgcrypt Loading commit data...
libgpg-error Loading commit data...
libidn Loading commit data...
libmnl Loading commit data...
libpipeline Loading commit data...
libssh2 Loading commit data...
libtool Loading commit data...
libucontext Loading commit data...
libuv Loading commit data...
libxml2 Loading commit data...
libxslt Loading commit data...
linenoise Loading commit data...
linux-pam Loading commit data...
lua5.3 Loading commit data...
lutok Loading commit data...
lvm2 Loading commit data...
lz4 Loading commit data...
lzip Loading commit data...
lzo Loading commit data...
lzop Loading commit data...
m4 Loading commit data...
mailx Loading commit data...
make Loading commit data...
man-db Loading commit data...
man-pages Loading commit data...
mawk Loading commit data...
mpc1 Loading commit data...
mpfr3 Loading commit data...
musl Loading commit data...
ncurses Loading commit data...
net-tools Loading commit data...
nspr Loading commit data...
nss Loading commit data...
nvi Loading commit data...
openrc Loading commit data...
openssh Loading commit data...
openssl Loading commit data...
parted Loading commit data...
patch Loading commit data...
pax-utils Loading commit data...
paxmark Loading commit data...
pcre Loading commit data...
pcre2 Loading commit data...
perl Loading commit data...
perl-authen-sasl Loading commit data...
perl-cpanel-json-xs Loading commit data...
perl-dbd-sqlite Loading commit data...
perl-dbi Loading commit data...
perl-digest-hmac Loading commit data...
perl-digest-sha1 Loading commit data...
perl-encode-eucjpascii Loading commit data...
perl-encode-hanextra Loading commit data...
perl-encode-iso2022 Loading commit data...
perl-encode-jisx0213 Loading commit data...
perl-encode-locale Loading commit data...
perl-error Loading commit data...
perl-extutils-config Loading commit data...
perl-extutils-helpers Loading commit data...
perl-extutils-installpaths Loading commit data...
perl-file-listing Loading commit data...
perl-file-remove Loading commit data...
perl-html-parser Loading commit data...
perl-html-tagset Loading commit data...
perl-http-cookies Loading commit data...
perl-http-daemon Loading commit data...
perl-http-date Loading commit data...
perl-http-message Loading commit data...
perl-http-negotiate Loading commit data...
perl-io-html Loading commit data...
perl-io-socket-ssl Loading commit data...
perl-json Loading commit data...
perl-json-maybexs Loading commit data...
perl-libwww Loading commit data...
perl-lwp-mediatypes Loading commit data...
perl-mime-charset Loading commit data...
perl-module-build Loading commit data...
perl-module-build-tiny Loading commit data...
perl-module-install Loading commit data...
perl-module-scandeps Loading commit data...
perl-net-http Loading commit data...
perl-net-libidn Loading commit data...
perl-net-smtp-ssl Loading commit data...
perl-net-ssleay Loading commit data...
perl-pod2-base Loading commit data...
perl-sgmls Loading commit data...
perl-sub-uplevel Loading commit data...
perl-test-exception Loading commit data...
perl-test-fatal Loading commit data...
perl-test-harness Loading commit data...
perl-test-leaktrace Loading commit data...
perl-test-needs Loading commit data...
perl-test-nowarnings Loading commit data...
perl-test-pod Loading commit data...
perl-test-requires Loading commit data...
perl-test-requiresinternet Loading commit data...
perl-test-simple Loading commit data...
perl-test-warn Loading commit data...
perl-test-without-module Loading commit data...
perl-try-tiny Loading commit data...
perl-unicode-linebreak Loading commit data...
perl-uri Loading commit data...
perl-www-robotrules Loading commit data...
perl-yaml-syck Loading commit data...
perl-yaml-tiny Loading commit data...
pkgconf Loading commit data...
po4a Loading commit data...
popt Loading commit data...
procps Loading commit data...
psmisc Loading commit data...
python3 Loading commit data...
rhash Loading commit data...
rsync Loading commit data...
ruby Loading commit data...
s6 Loading commit data...
s6-linux-init Loading commit data...
sed Loading commit data...
shadow Loading commit data...
sharutils Loading commit data...
shimmy Loading commit data...
skalibs Loading commit data...
sp Loading commit data...
sqlite Loading commit data...
ssmtp Loading commit data...
strace Loading commit data...
sudo Loading commit data...
sysklogd Loading commit data...
sysvinit Loading commit data...
tcl Loading commit data...
texinfo Loading commit data...
tzdata Loading commit data...
unzip Loading commit data...
util-linux Loading commit data...
utmps Loading commit data...
uucp Loading commit data...
vim Loading commit data...
xfsprogs Loading commit data...
xmlto Loading commit data...
xz Loading commit data...
yaml Loading commit data...
zip Loading commit data...
zlib Loading commit data...
zsh Loading commit data...
zstd Loading commit data...
.rootbld-repositories Loading commit data...