]> git.ipfire.org Git - thirdparty/glibc.git/commit - NEWS
libio: do not attempt to free wide buffers of legacy streams [BZ #24228]
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 13 Feb 2019 01:20:51 +0000 (01:20 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 20 Jun 2019 17:32:07 +0000 (17:32 +0000)
commit91b02c5b4d17d60015af24d277eb31348fc0bc34
tree7fe55e67a0cd8f4c2430473a25020e494f897965
parent58d2672f64176fcb323859d3bd5240fb1cf8f25c
libio: do not attempt to free wide buffers of legacy streams [BZ #24228]

Commit a601b74d31ca086de38441d316a3dee24c866305 aka glibc-2.23~693
("In preparation for fixing BZ#16734, fix failure in misc/tst-error1-mem
when _G_HAVE_MMAP is turned off.") introduced a regression:
_IO_unbuffer_all now invokes _IO_wsetb to free wide buffers of all
files, including legacy standard files which are small statically
allocated objects that do not have wide buffers and the _mode member,
causing memory corruption.

Another memory corruption in _IO_unbuffer_all happens when -1
is assigned to the _mode member of legacy standard files that
do not have it.

[BZ #24228]
* libio/genops.c (_IO_unbuffer_all)
[SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)]: Do not attempt to free wide
buffers and access _IO_FILE_complete members of legacy libio streams.
* libio/tst-bz24228.c: New file.
* libio/tst-bz24228.map: Likewise.
* libio/Makefile [build-shared] (tests): Add tst-bz24228.
[build-shared] (generated): Add tst-bz24228.mtrace and
tst-bz24228.check.
[run-built-tests && build-shared] (tests-special): Add
$(objpfx)tst-bz24228-mem.out.
(LDFLAGS-tst-bz24228, tst-bz24228-ENV): New variables.
($(objpfx)tst-bz24228-mem.out): New rule.

(cherry picked from commit 21cc130b78a4db9113fb6695e2b951e697662440)
ChangeLog
NEWS
libio/Makefile
libio/genops.c
libio/tst-bz24228.c [new file with mode: 0644]
libio/tst-bz24228.map [new file with mode: 0644]